setuptools icon indicating copy to clipboard operation
setuptools copied to clipboard

pip3 is stopped working when I installed Python3.6

Open jacocal opened this issue 8 years ago • 1 comments

pip3 command used to be working while I programmed in python3.5, after installing python3.6 it now shows this error when it runs?

  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
  File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 26, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/local/lib/python3.5/dist-packages/pip/utils/__init__.py", line 27, in <module>
    from pip._vendor import pkg_resources
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
    @_call_aside
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
    dist.activate(replace=False)
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
    declare_namespace(pkg)
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/usr/local/lib/python3.5/dist-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'm not an expert on this and have very little knowledge about this kind of error. Anyone able to help?

jacocal avatar Jan 15 '18 03:01 jacocal

The underlying issue is pypa/pip#4216. The issue has been fixed (worked around) in pkg_resources (#885), but pip has yet to incorporate the fix.

The issue is probably triggered by an improperly-installed namespace package (or directory without __init__.py in your sys.path). It's a little surprising that you encountered the issue by installing Python 3.6. My guess is your distribution, when you installed Python 3.6, changed something in your site packages. I note that pip3 is still using Python 3.5. Maybe try removing Python 3.6 and see if your pip3 starts working again.

Otherwise, the best I can recommend is to roll back to a clean Python install(s). If you can replicate the issue on a clean system and share those replication steps here, we can investigate further.

jaraco avatar Jan 15 '18 13:01 jaraco