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.env" when "python setup.py egg_info" #9444

Closed
amirtaherkhani opened this issue Jul 14, 2018 · 16 comments
Labels

Comments

@amirtaherkhani
Copy link

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/25/n99fqy7d35x3zp9209b8q0jc0000gn/T/pip-install-hBquje/caffe2/setup.py", line 108, in <module>
    from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
ImportError: No module named tools.setup_helpers.env

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/25/n99fqy7d35x3zp9209b8q0jc0000gn/T/pip-install-hBquje/caffe2/

@ml7
Copy link

ml7 commented Jul 16, 2018

Hello Amir, can you provide more details about the install process you followed up until this point?

@pjh5 pjh5 added the caffe2 label Jul 16, 2018
@pjh5 pjh5 changed the title pip install caffe2 "ImportError: No module named tools.setup_helpers.env" when "python setup.py egg_info" Jul 16, 2018
@pjh5
Copy link
Contributor

pjh5 commented Jul 16, 2018

@amirtaherkhani what are you trying to do? If you want to build Caffe2 you have to use "FULL_CAFFE2=1 python setup.py"

@lunzueta
Copy link

I have the same issue when I just put pip install caffe2 in the command prompt (in Windows 10, with all the Python stuff installed). More specifically, I get the following output:

Collecting caffe2
  Using cached https://files.pythonhosted.org/packages/0f/b5/b4824aeeef2fc0a54e6f9f090545a486c2e5db0e18faae011c16465ee917/caffe2-0.5.0a0.dev100.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\xps8900\appdata\local\temp\pip-install-3fztis\caffe2\setup.py", line 108, in <module>
        from tools.setup_helpers.env import check_env_flag, check_negative_env_flag
    ImportError: No module named tools.setup_helpers.env

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\xps8900\appdata\local\temp\pip-install-3fztis\caffe2\

@snkchrist
Copy link

snkchrist commented Jul 17, 2018

Same here with pip install caffe2
$ pip install caffe2

Collecting caffe2
  Using cached https://files.pythonhosted.org/packages/0f/b5/b4824aeeef2fc0a54e6f9f090545a486c2e5db0e18faae011c16465ee917/caffe2-0.5.0a0.dev100.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\onnx\AppData\Local\Temp\pip-build-8uncpar5\caffe2\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'

@pjh5
Copy link
Contributor

pjh5 commented Jul 17, 2018

Does it work if you do "FULL_CAFFE2=1 python setup.py install" instead?

@amirtaherkhani
Copy link
Author

@ml7 @pjh5 It was a great tip, thanks for answer

@nathlacroix
Copy link

@pjh5 is there a way to modify the pip setup command ? I exported the variable FULL_CAFFE2=1 but according to your command I still have to replace egg_info by install (so far I still get the same error as snkchrist).

@pjh5
Copy link
Contributor

pjh5 commented Jul 18, 2018

Why do you want to use egg_info? My understanding was that setup.py install builds and copies libraries/source-code into your Python installation so that it can be used and that setup.py develop builds and symlinks libraries/source-code into your Python installation so that it can still be used but still refers to source code in the build folder that's more easily modifiable. What do you need from setup.py egg_info that is not provided by those two commands?

@nathlacroix
Copy link

Thank you for your answer. My comment wasn't very clear : how should I use the pip command such that I can launch the setup.py install ? Because as soon as I use pip, it automatically does the command python setup.py egg_info and I thus get the error. So when / how / where specifically should i run the setup.py install command ?
Pip downloads the files in a temporary folder but when I try to access it afterwards it does not exist anymore.

@pjh5
Copy link
Contributor

pjh5 commented Jul 19, 2018

The command you need to use is "FULL_CAFFE2=1 python setup.py install" in the Pytorch root directory.

@lcxywfe
Copy link

lcxywfe commented Jul 31, 2018

I use
"sudo FULL_CAFFE2=1 mdl python setup.py install"
get
Failed to run 'bash tools/build_pytorch_libs.sh --use-cuda --use-nnpack --full-caffe2 nccl caffe2 nanopb libshm gloo THD c10d'

@pjh5
Copy link
Contributor

pjh5 commented Jul 31, 2018

@lcxywfe can you post a new issue with the full error message that you are getting? Also please read https://caffe2.ai/docs/faq.html#null__how-do-python-installations-work ; we advise you to not use sudo when installing via setuptools.

@jfleach
Copy link

jfleach commented Aug 16, 2018

@nathlacroix I'd like to know the answer to this too. I am having the same problem and opened an issue on stackoverflow.

https://stackoverflow.com/questions/51881295/python-caffe2-importerror-no-module-named-tools-setup-helpers-env

@losDaniel
Copy link

When I try "FULL_CAFFE2=1 python setup.py install" I get:

"'FULL_CAFFE2' is not recognized as an internal or external command, operable program or batch file."

I've tried running it from the Pytorch root dir but still get the same. Where exactly do you run that command, and should I be using my ordinary Anaconda prompt?

@ezyang
Copy link
Contributor

ezyang commented Dec 17, 2018

What shell are you using? Can you do env FULL_CAFFE2=1 python setup.py install?

@pjh5
Copy link
Contributor

pjh5 commented Dec 17, 2018

The command

FULL_CAFFE2=1 python setup.py install

simply sets the environment variable 'FULL_CAFFE2' to 1 and then calls 'python setup.py install', so if it is not recognized as a command then you are not running in bash or shell. Your error message references a batch file, so is this Windows? This may not be supported syntax on Windows.

Anyways, the env variable FULL_CAFFE2 no longer affects our build process at all. All the advice earlier in this thread is obsolete by now, so if you are getting an error message during build please open a new issue.

@pjh5 pjh5 closed this as completed Dec 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants