_NamespacePath object has no attribute sort
See original GitHub issue- Pip version: 9.0.1
- Python version: 3.6
- Operating System: macOS
It seems that pip by way of vendoring Setuptools is triggering the issue reported in pypa/setuptools#885 (and may likely be implicated in the ongoing reports of users experiencing the issue). Here’s a traceback that occurs when pip freeze
is invoked by tox
during a test run after completing the develop-inst-no-deps
step.
Traceback (most recent call last):
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/bin/pip", line 7, in <module>
from pip import main
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
@_call_aside
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/Users/jaraco/Dropbox/code/yg/support/yg.piistore/.tox/python/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
I imagine the only fix is to re-vendor setuptools with 31.0.1 or later.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:15
- Comments:99 (31 by maintainers)
Top Results From Across the Web
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 ... - GitHub
I was trying install with pip install --upgrade google-cloud but I get the following AttributeError: '_NamespacePath' object has no attribute 'sort'.
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 has no attribute sort" during ...
PY-24691 "No packaging tools found" when sphinxcontrib-websupport is installed: '_NamespacePath' object has no attribute 'sort'.
Read more >Trying to uninstall TensorFlow or Matplotlib pip package ...
Trying to uninstall TensorFlow or Matplotlib pip package throws AttributeError: '_NamespacePath' object has no attribute 'sort'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I tried these tricks, and as far as now nothing worked, so here is my durty-and-useful fix: in
/path/to/usr/local/python3.5/dist-packages/
, for the filepip/_vendor/pkg_resources/__init__.py
, line 2121, change:with
Could not do anything with pip in my virtualenv. Even got the error when just typing
pip
.An
easy_install pip
in my virtualenv has made it workable again, though the error still appeared at the end of an install.