Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named 'tools.setup_helpers' #707

Closed
shawnjhenry opened this issue Feb 9, 2017 · 23 comments
Closed

ImportError: No module named 'tools.setup_helpers' #707

shawnjhenry opened this issue Feb 9, 2017 · 23 comments

Comments

@shawnjhenry
Copy link

Hi,

I tried to update PyTorch using pip and I got this error message. For some reason python 3.5 isn't recognizing tools.setup_helpers as a module. Any idea why that might be/how to fix it?

Thanks,
Shawn

@apaszke
Copy link
Contributor

apaszke commented Feb 9, 2017

Can you please show me the command you ran and the full stack trace it gives you?

@shawnjhenry
Copy link
Author

shawnjhenry commented Feb 9, 2017

Sure. I ran python -m pip install --upgrade pytorch and the full trace is:

Collecting pytorch
  Using cached pytorch-0.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/d8/8mxqq9894596k_kkx5n4vrjw0000gn/T/pip-build-h08vn10j/pytorch/setup.py", line 12, in <module>
        from tools.setup_helpers.env import check_env_flag
    ImportError: No module named 'tools.setup_helpers'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/d8/8mxqq9894596k_kkx5n4vrjw0000gn/T/pip-build-h08vn10j/pytorch/

I tried deleting the cached version and doing a fresh download. That didn't work either.

@soumith
Copy link
Member

soumith commented Feb 10, 2017

since pytorch is not on PyPI yet, doing pip install --upgrade pytorch will not work.
You need to install a new wheel / conda binary with the commands from the website pytorch.org

@soumith soumith closed this as completed Feb 10, 2017
@StatML
Copy link

StatML commented Feb 18, 2017

When I use the command pip3 install torch
I also got the same warning

Reading https://pypi.python.org/simple/torch/
Downloading https://pypi.python.org/packages/8e/f0/f3fa374272cebc980b38d77c4a61d9cf1a5aceb76b26b5f0311439595ac4/torch-0.1.tar.gz#md5=a14e9d9d9ecb0681e5ab168f1ce148e0
Best match: torch 0.1
Processing torch-0.1.tar.gz
Writing /tmp/easy_install-vjbggel_/torch-0.1/setup.cfg
Running torch-0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vjbggel_/torch-0.1/egg-dist-tmp-45icbvje
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 157, in save_modules
yield saved
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 255, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 285, in run
return func()
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 253, in runner
_execfile(setup_script, ns)
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 47, in execfile
exec(code, globals, locals)
File "/tmp/easy_install-vjbggel
/torch-0.1/setup.py", line 12, in
# same as ./requirements.txt
ImportError: No module named 'tools.setup_helpers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "setup.py", line 35, in
install_requires=requirements,
File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/install.py", line 117, in do_egg_install
cmd.run()
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 411, in run
self.easy_install(spec, not self.no_deps)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 655, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 702, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 747, in process_distribution
[requirement], self.local_index, self.easy_install
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 851, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 1123, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 1135, in obtain
return installer(requirement)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 674, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 700, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 881, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 1120, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 1106, in run_setup
run_setup(setup_script, args)
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 258, in run_setup
raise
File "/usr/lib/python3.5/contextlib.py", line 77, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/lib/python3.5/contextlib.py", line 77, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 169, in save_modules
saved_exc.resume()
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 144, in resume
six.reraise(type, exc, self._tb)
File "/usr/lib/python3/dist-packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 157, in save_modules
yield saved
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 255, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 285, in run
return func()
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 253, in runner
_execfile(setup_script, ns)
File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 47, in execfile
exec(code, globals, locals)
File "/tmp/easy_install-vjbggel
/torch-0.1/setup.py", line 12, in
# same as ./requirements.txt
ImportError: No module named 'tools.setup_helpers'

Thanks,
Eric

@soumith
Copy link
Member

soumith commented Feb 18, 2017

as i mentioned above, pip3 install torch will not work.

@svohara
Copy link

svohara commented Mar 1, 2017

I have a similar problem. I follow the instructions on installing pytorch on Linux via pip, python 3.5. The two commands in the instructions are as follows:

pip install https://s3.amazonaws.com/pytorch/whl/cu80/torch-0.1.9.post2-cp35-cp35m-linux_x86_64.whl pip install torchvision

The first (installation of the wheel) was fine. The second gave the ImportError: No module named 'tools.setup_helpers'. So I'm not sure this issue should be closed.

Here's the output:

Collecting torchvision
  Using cached torchvision-0.1.7-py2.py3-none-any.whl
Collecting numpy (from torchvision)
  Using cached numpy-1.12.0-cp35-cp35m-manylinux1_x86_64.whl
Collecting torch (from torchvision)
  Using cached torch-0.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-1si6f0br/torch/setup.py", line 12, in <module>
        from tools.setup_helpers.env import check_env_flag
    ImportError: No module named 'tools.setup_helpers'```

@soumith
Copy link
Member

soumith commented Mar 2, 2017

@svohara for some reason it's trying to reinstall torch from pypi. I have no idea why it's trying to do that, considering you already installed torch via the wheel. What is the version of pip that you are using?

What's the output of the command:
pip --version?

@lukeyeager
Copy link
Contributor

@svohara try using three backticks for quoting instead of one. That's hard to read.

Using cached torch-0.1.tar.gz 

Try finding and deleting that file.

@unnir
Copy link

unnir commented Mar 6, 2017

same error message for
pip install pytorch


 Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/09/fk9rwtks5ldgd6l8z145rmqc0000gn/T/pip-build-i7h0xo54/pytorch/setup.py", line 12, in <module>
        from tools.setup_helpers.env import check_env_flag
    ImportError: No module named 'tools.setup_helpers'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/09/fk9rwtks5ldgd6l8z145rmqc0000gn/T/pip-build-i7h0xo54/pytorch/

I'm using mac and python 3.5

@soumith
Copy link
Member

soumith commented Mar 6, 2017

@unnir pip install pytorch is not a valid or good thing to do. Where did you find that command?

@lukeyeager
Copy link
Contributor

@soumith I expect people will just keep doing this until there's a working package on PyPI. That's just the first thing people are going to try for a Python project.

Maybe you could upload an 0.2 wheel that just prints a more helpful error like:

Installation from PyPI not supported yet (see status at https://github.com/pytorch/pytorch/issues/566). For now, please uninstall this package (pip uninstall pytorch) and follow the instructions at http://pytorch.org/ to install with miniconda.

@unnir
Copy link

unnir commented Mar 6, 2017

@soumith from the same place as I got a common sense.

normally I'm using pip for installing packages.

@lukeyeager totally agree.

@soumith
Copy link
Member

soumith commented Mar 6, 2017

@unnir i didn't mean you dont have common sense. Sorry about that.
@lukeyeager ok i'll try to get to that.

@jayThakkarM
Copy link

Install by pytorch.org
Not use pipy website for install
Surely it will done

ashishfarmer pushed a commit to ashishfarmer/pytorch that referenced this issue Aug 12, 2020
mcarilli pushed a commit to mcarilli/pytorch that referenced this issue Mar 18, 2021
Fix nested loop traversal
@Vrouqen
Copy link

Vrouqen commented Jul 9, 2022

I did't fix my problem. I'm trying to install Caffe2 for python (3.8.7). It shows me this message:

Collecting caffe2
  Using cached caffe2-0.5.0a0.dev100.tar.gz (10.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\public\AppData\Local\Temp\pip-install-fzodf6_o\caffe2_b5c576cb0e594f0e8dfd74d884955f14\setup.py", line 108, in <module>
          from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
      ModuleNotFoundError: No module named 'tools.setup_helpers'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I need help as soon as possible :(

NOTE:
I already installed pytorch successfully, using pip3 install torch torchvision torchaudio

@wili-65535
Copy link

I did't fix my problem. I'm trying to install Caffe2 for python (3.8.7). It shows me this message:

Collecting caffe2
  Using cached caffe2-0.5.0a0.dev100.tar.gz (10.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\public\AppData\Local\Temp\pip-install-fzodf6_o\caffe2_b5c576cb0e594f0e8dfd74d884955f14\setup.py", line 108, in <module>
          from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
      ModuleNotFoundError: No module named 'tools.setup_helpers'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I need help as soon as possible :(

NOTE: I already installed pytorch successfully, using pip3 install torch torchvision torchaudio

The EXACTLY same problem I meet (during installing caffe2)

@mgalfre
Copy link

mgalfre commented Apr 3, 2023

I did't fix my problem. I'm trying to install Caffe2 for python (3.8.7). It shows me this message:

Collecting caffe2
  Using cached caffe2-0.5.0a0.dev100.tar.gz (10.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\public\AppData\Local\Temp\pip-install-fzodf6_o\caffe2_b5c576cb0e594f0e8dfd74d884955f14\setup.py", line 108, in <module>
          from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
      ModuleNotFoundError: No module named 'tools.setup_helpers'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I need help as soon as possible :(

NOTE: I already installed pytorch successfully, using pip3 install torch torchvision torchaudio

Same problem here!

@LoveAsAConstruct
Copy link

LoveAsAConstruct commented Jul 13, 2023

Collecting caffe2
Using cached caffe2-0.5.0a0.dev100.tar.gz (10.7 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\isaia\AppData\Local\Temp\pip-install-oe5t2frd\caffe2_a0167a5b2634468d821bedbe973eea78\setup.py", line 108, in
from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
ModuleNotFoundError: No module named 'tools.setup_helpers'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Same issue here as well

@DominikWA
Copy link

I did't fix my problem. I'm trying to install Caffe2 for python (3.8.7). It shows me this message:

Collecting caffe2
  Using cached caffe2-0.5.0a0.dev100.tar.gz (10.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\public\AppData\Local\Temp\pip-install-fzodf6_o\caffe2_b5c576cb0e594f0e8dfd74d884955f14\setup.py", line 108, in <module>
          from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
      ModuleNotFoundError: No module named 'tools.setup_helpers'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I need help as soon as possible :(

NOTE: I already installed pytorch successfully, using pip3 install torch torchvision torchaudio

I have the same problem

@guohuanliang1
Copy link

I did't fix my problem. I'm trying to install Caffe2 for python (3.8.7). It shows me this message:

Collecting caffe2
  Using cached caffe2-0.5.0a0.dev100.tar.gz (10.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\public\AppData\Local\Temp\pip-install-fzodf6_o\caffe2_b5c576cb0e594f0e8dfd74d884955f14\setup.py", line 108, in <module>
          from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
      ModuleNotFoundError: No module named 'tools.setup_helpers'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I need help as soon as possible :(
NOTE: I already installed pytorch successfully, using pip3 install torch torchvision torchaudio

I have the same problem

I have the same problem too

@stupidcucumber
Copy link

Well, I feel like this must be fixed somehow.... I am also facing the same problem guys...

@ChrisHuang96
Copy link

Same problem. Use export FULL_CAFFE2=1 firstly and build from sorce (branch v2.4.0). Torch works well but when I use pip install caffe2,I get

Collecting caffe2
  Using cached caffe2-0.5.0a0.dev100.tar.gz (10.7 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-i_faspwa/caffe2_6bf5d76bcddc4318b88e7aef5c343901/setup.py", line 108, in <module>
          from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
      ModuleNotFoundError: No module named 'tools.setup_helpers'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

@mhrrs
Copy link

mhrrs commented Aug 27, 2024

I'm facing the same problem... 7 years is quite a long time for this issue to exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests