alanhamlett/pip-update-requirements

Python 3.6: AttributeError: '_NamespacePath' object has no attribute 'sort'

andychase opened this issue · 1 comments

Traceback (most recent call last):
  File "/usr/local/bin/pur", line 7, in <module>
    from pur.__init__ import pur
  File "/usr/local/lib/python3.6/site-packages/pur/__init__.py", line 24, in <module>
    from pip.download import PipSession
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/__init__.py", line 26, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/utils/__init__.py", line 27, in <module>
    from pip._vendor import pkg_resources
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/_vendor/pkg_resources/__init__.py", line 3017, in <module>
    @_call_aside
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/_vendor/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/_vendor/pkg_resources/__init__.py", line 3045, in _initialize_master_working_set
    dist.activate(replace=False)
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/_vendor/pkg_resources/__init__.py", line 2577, in activate
    declare_namespace(pkg)
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/_vendor/pkg_resources/__init__.py", line 2151, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/_vendor/pkg_resources/__init__.py", line 2091, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/usr/local/lib/python3.6/site-packages/pur/packages/pip/_vendor/pkg_resources/__init__.py", line 2120, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'

Installing from the bleeding edge as suggested here: googleapis/google-cloud-python#2990 (comment)

And then copying the pip directory into pur/packages/pip fixed the issue for me.