-1

I have been installing a series of basic packages for python 3 (numpy, etc.) with pip 3 and everything was fine. Then I tried to install tensorflow-gpu and I got

user@computer:~$ pip3 install --upgrade tensorflow-gpu
Traceback (most recent call last):
  File "/usr/lib/python3/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/bin/pip3", line 9, in <module>
    from pip import main
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 13, in <module>
    from pip.exceptions import InstallationError, CommandError, PipError
  File "/usr/lib/python3/dist-packages/pip/exceptions.py", line 6, in <module>
    from pip._vendor.six import iteritems
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 75, in <module>
    vendored("pkg_resources")
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", 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 <module>
  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 <lambda>
  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'

I purged python3-pip and reinstalled it, this did not help.

EDIT: I get the same error if I simply run pip3 in the terminal.

EDIT2: Ok, just to make things clear, I am unable to use pip3 for any task. Running pip3 install setuptools gives the same error. Also I did not find any solution in the supposed duplicate questions.

Qubix
  • 3,372
  • 7
  • 21
  • 54
  • [Possibly related issue](https://stackoverflow.com/questions/7446187/no-module-named-pkg-resources/10538412#10538412) – Norrius Jan 21 '18 at 20:16
  • @Norrius , I don't see how they are related? – Qubix Jan 21 '18 at 20:23
  • You're also getting `No module named pkg_resources` when trying to use pip. Note that I said *possibly* related, there might be no correlation after all. – Norrius Jan 21 '18 at 20:29
  • Possible duplicate of [installing google-cloud using pip fails](https://stackoverflow.com/questions/43124732/installing-google-cloud-using-pip-fails) – phd Jan 22 '18 at 01:58
  • @phd I cannot run pip3 install --upgrade setuptools. I cannot use pip3 for anything ! – Qubix Jan 22 '18 at 09:18
  • Time to [reinstall `pip`](https://stackoverflow.com/questions/42184792/pip-does-not-work-after-upgrade-to-ubuntu-16-10) and `setuptools`. – phd Jan 22 '18 at 11:20

1 Answers1

0
AttributeError: '_NamespacePath' object has no attribute 'sort'

This looks as if your missing another module you could try

pip3 install setuptools
fredwntr1
  • 38
  • 5