问题
I cannot install the Python caffe2 module from the PyPi repository. When issuing sudo pip install caffe2
the following error occurs:
$ sudo pip install caffe2 The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting caffe2 Downloading https://files.pythonhosted.org/packages/0f/b5/b4824aeeef2fc0a54e6f9f090545a486c2e5db0e18faae011c16465ee917/caffe2-0.5.0a0.dev100.tar.gz (10.7MB) 100% |████████████████████████████████| 10.7MB 3.3MB/s Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-C5vRaw/caffe2/setup.py", line 108, in 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 /tmp/pip-install-C5vRaw/caffe2/
I have read the installation documentation and have all the dependencies installed, but this error persists. There is a similar issue on GitHub, but the answers aren't clear and it doesn't resolve my problem. Does anyone know how to fix this problem or a workaround for installing the module?
The same issue occurs when using pip3 instead of pip(2).
Thanks for your help.
回答1:
This package requires PyTorch. tools.setup_helpers is a package in PyTorch.
See other ways to install Caffe2 at https://caffe2.ai/docs/getting-started.html
来源:https://stackoverflow.com/questions/51881295/python-caffe2-importerror-no-module-named-tools-setup-helpers-env