pipenv: AttributeError: '_NamespacePath' object has no attribute 'sort' when running pipenv on arch
I installed pipenv (with pip) on my arch machine recently, and it’s giving me an exception on startup.
Googling around it seems like it might related to this issue: pypa/setuptools#885, but my setuptools is fully updated which seems to be the fix listed in that thread.
output
→ sudo pip install --upgrade pipenv pip setuptools
→ pipenv --help
Traceback (most recent call last):
File "/usr/bin/pipenv", line 7, in <module>
from pipenv import cli
File "/usr/lib/python3.6/site-packages/pipenv/__init__.py", line 13, in <module>
from .cli import cli
File "/usr/lib/python3.6/site-packages/pipenv/cli.py", line 20, in <module>
import pip
File "/usr/lib/python3.6/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/usr/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
@_call_aside
File "/usr/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/usr/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/usr/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/usr/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'
system info
→ pip -V
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
→ pip show pipenv
Name: pipenv
Version: 7.0.5
Summary: Sacred Marriage of Pipfile, Pip, & Virtualenv.
Home-page: https://github.com/kennethreitz/pipenv
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: MIT
Location: /usr/lib/python3.6/site-packages
Requires: semver, setuptools, pip-tools, pip, pew, virtualenv, requests
→ pip show setuptools
Name: setuptools
Version: 36.4.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /usr/lib/python3.6/site-packages
Requires:
→ uname -a
Linux jubal 4.12.8-2-ARCH #1 SMP PREEMPT Fri Aug 18 14:08:02 UTC 2017 x86_64 GNU/Linux
→ python -V
Python 3.6.2
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 23 (15 by maintainers)
Try v11.6.0.
I love how solving one problem solves another 😃
this looks to be a problem with pip, not with pipenv.
Fixed with the upgrade. Thank you @kennethreitz !