I have been having permission issues with pip
.
I cannot run pip3 -V
or pip3.5 -V
. It gives me the following error:
AttributeError: '_NamespacePath' object has no attribute 'sort'
However, pip -V
run fines. Then again pip --user <package-name>
gives the same error.
I also tried doing the same thing with Anaconda installation, but I have the same issue.
I am new to python so I may be doing something trivially wrong.
Relevant details:
OS: Ubuntu 16.04
Python versions: 2.7, 3, 3.5, 3.6 through Anaconda
I have updated setuptools
and pip
.
Relevant links that provided me some insight but the solution did not work:
Error when issuing pip3 -V
Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/_vendor/init.py", line 33, in vendored import(vendored_name, globals(), locals(), level=0) ImportError: No module named 'pip._vendor.pkg_resources'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/bin/pip3", line 7, in from pip import main File "/usr/lib/python2.7/dist-packages/pip/init.py", line 13, in from pip.exceptions import InstallationError, CommandError, PipError File "/usr/lib/python2.7/dist-packages/pip/exceptions.py", line 6, in from pip._vendor.six import iteritems File "/usr/lib/python2.7/dist-packages/pip/_vendor/init.py", line 75, in vendored("pkg_resources") File "/usr/lib/python2.7/dist-packages/pip/_vendor/init.py", line 36, in vendored import(modulename, globals(), locals(), level=0) File "", line 969, in _find_and_load File "", line 958, in _find_and_load_unlocked File "", line 664, in _load_unlocked
File "", line 634, in _load_backward_compatible File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2927, in File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2913, in _call_aside File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2952, in _initialize_master_working_set File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 956, in subscribe File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2952, in File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2515, in activate File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2097, in declare_namespace File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2047, in _handle_ns File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2066, in _rebuild_mod_path AttributeError: '_NamespacePath' object has no attribute 'sort'
Please feel free to ask more details.
sudo pip3 -V
. However, documentation says I should NOT be usingsudo
, I should rather be usingpip3 install --user <package>
– Marvinpip
referring toFile "/usr/lib/python2.7/dist-packages/pip/_vendor/init.py"
. I would imagine Python3 referring to some python3 directories rather than python2.7. Also, I created a local directory and compiled python3.6 from source and installed in a local directory (not /usr/local/bin). The pip command in the new installation also refers to the same python2.7 directory! Maybe this is how it should be, but really confused and wondering if my configuration is wrong. – Marvinpip3
(in the personal directory installation from source) and it has a line from pip import main. Now when I runpip3 -V
it refers to an error coming from/usr/lib/python2.7...
. Something tells me this is an issue. I guess it should be getting the packages from the local folder installation and be agnostic to what is installed in my system! – Marvinpython3 -m pip
instead ofpip3
? Does that get you anything? Also, does your Anaconda have a functioningpip
at all? IIRC they lobotomized it. – Kevin