_NamespacePath object has no attribute sort (38.5.1)
See original GitHub issueUsing Python 3.6, pip 9.0.1 and 38.5.1 I get the following error:
$ bin/pip list
Traceback (most recent call last):
File "bin/pip", line 7, in <module>
from pip import main
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/lib/python3.6/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/lib/python3.6/site-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
@_call_aside
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/Users/wichert/.local/share/virtualenvs/curvetips.api-ihv708oq/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'
This is a virtualenv made yesterday using pipenv.
As requested in #885 the nspath data is:
$ for pth in $(ls lib/python3.6/site-packages/*-nspkg.pth); do echo $pth ; cat $pth ; done
lib/python3.6/site-packages/PasteDeploy-1.5.2-py2.6-nspkg.pth
import sys,types,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('paste',)); ie = os.path.exists(os.path.join(p,'__init__.py')); m = not ie and sys.modules.setdefault('paste',types.ModuleType('paste')); mp = (m or []) and m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p)
lib/python3.6/site-packages/curvetips.logging-1.4.2-py3.6-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('curvetips',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('curvetips', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('curvetips', [os.path.dirname(p)])));m = m or sys.modules.setdefault('curvetips', types.ModuleType('curvetips'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/curvetips.model-1.0.3-py3.6-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('curvetips',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('curvetips', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('curvetips', [os.path.dirname(p)])));m = m or sys.modules.setdefault('curvetips', types.ModuleType('curvetips'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/curvetips.utils-1.1.0-py3.6-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('curvetips',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('curvetips', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('curvetips', [os.path.dirname(p)])));m = m or sys.modules.setdefault('curvetips', types.ModuleType('curvetips'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/google_auth-1.4.1-py3.6-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('google',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('google', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('google', [os.path.dirname(p)])));m = m or sys.modules.setdefault('google', types.ModuleType('google'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/repoze.lru-0.7-py3.6-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('repoze',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('repoze', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('repoze', [os.path.dirname(p)])));m = m or sys.modules.setdefault('repoze', types.ModuleType('repoze'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/zope.component-4.4.1-py3.4-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/zope.deprecation-4.3.0-py3.6-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/zope.event-4.3.0-py3.5-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/zope.interface-4.4.3-py3.6-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
lib/python3.6/site-packages/zope.sqlalchemy-1.0-py3.6-nspkg.pth
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 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 >_NamespacePath object has no attribute sort · Issue #4216 ...
I got the same error ( '_NamespacePath' object has no attribute 'sort' ). I hope the following details of my setup are of...
Read more >attributeError: '_NamespacePath' object has no attribute 'sort'
hello I work on Python 3.6 and I could not install a module : pip3.6 ... attributeError: '_NamespacePath' object has no attribute 'sort'....
Read more >解决pip 问题AttributeError: '_NamespacePath' object has no ...
AttributeError : '_NamespacePath' object has no attribute 'sort' ... 简单来说就是:在__init__.py中第2021行orig_path.sort时没有sort属性,参考 ...
Read more >'_NamespacePath' object has no attribute 'sort'をなおした話
More than 3 years have passed since last update. ... pip3 error - '_NamespacePath' object has no attribute 'sort'.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop 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
Top GitHub Comments
The _path_ attribute should always be treated as an interable, not a list (the Python docs describe _path_ as an iterable). The line in pkg_resources/_init_.py that reads:
Should be:
As a general rule (if practical), in-place sorting should not be used.
I can’t believe this is not a Prio 1 ticket, but actually closed! The fix still appear to be unshipped, and I am getting tired of applying the edit manually after some new py install;) please guys, could someone just merge that? for the fix, see: https://github.com/pypa/setuptools/issues/1282#issuecomment-372422080