question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`ModuleNotFoundError: No module named 'pip._vendor.pkg_resources'` AND `AttributeError: '_NamespacePath' object has no attribute 'sort'`

See original GitHub issue
  • Pip version: I believe it is 8.1.2
  • Python version: 3.6.0
  • Operating system: Ubuntu Server 16.10 (x64)

Description:

Pip errors whenever I use the command. It doesn’t matter which command. python3.6 -m pip errors.

What I’ve run:

logandark@LD-Server:~$ python3.6 -m pip
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)
ModuleNotFoundError: No module named 'pip._vendor.pkg_resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  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 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2976, in <module>
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2962, in _call_aside
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3004, 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 2535, in activate
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2109, in declare_namespace
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2058, in _handle_ns
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2078, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:24 (5 by maintainers)

github_iconTop GitHub Comments

21reactions
itay-grudevcommented, Jun 4, 2018

I had this issue on Arch and fixed it with:

sudo rm -rf /usr/lib/python3.6/site-packages/pip/
sudo pacman -Syu python-pip
5reactions
xavfernandezcommented, Mar 27, 2017

Closing as duplicate of #4216. It should be fixed in master (pip install -I https://github.com/pypa/pip/archive/master.zip#egg=pip to test).

Read more comments on GitHub >

github_iconTop Results From Across the Web

_NamespacePath object has no attribute sort · Issue #4216 ...
ModuleNotFoundError : No module named 'pip._vendor.pkg_resources' AND AttributeError: '_NamespacePath' object has no attribute 'sort' #4330.
Read more >
pip3 error - '_NamespacePath' object has no attribute 'sort'
I have tried running pip3 install --upgrade pip setuptools according to some answers, but every pip command gives me the error. I'm stuck...
Read more >
attributeError: '_NamespacePath' object has no attribute 'sort'
attributeError : '_NamespacePath' object has no attribute 'sort'. hello I work on Python 3.6 and I could not install a module : pip3.6 ......
Read more >
AttributeError: '_NamespacePath' object has no attribute 'sort ...
python3.6安装locust时,导致pip包出问题,出现报错AttributeError: '_NamespacePath' object has no attribute 'sort'.
Read more >
[Fixed] ModuleNotFoundError: No module named 'pip' - Finxter
Quick Fix: Python raises the ImportError: No module named 'pip' when it cannot ... The error might persist even after you have installed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found