Python 3.6.5
pip 19.0.2
setuptools 40.8.0
virtualenv 16.0.0
Have also tried to install these and then pip freeze.
google-api-core 1.7.0
google-auth 1.6.3
google-cloud-core 0.29.1
google-cloud-datastore 1.7.3
googleapis-common-protos 1.5.8
I get the following AttributeError: '_NamespacePath' object has no attribute 'sort'
I've also tried all options in AttributeError: '_NamespacePath' object has no attribute 'sort' #2990, but the issue was closed with no solution works for me, so I am trying to post here to seek solutions:
Below is the stack trace:
Installing collected packages: websockets, aiofiles, uvloop, ujson, httptools, sanic, schema, six, bosch, wrapt, multidict, docutils, jmespath, python-dateutil, botocore, pyparsing, packaging, async-timeout, chardet, idna, yarl, aiohttp, aiobotocore, hiredis, aioredis, numpy, pytz, pandas, pyarrow, backoff, thrift, jsonpickle, protobuf, googleapis-common-protos, opentracing, basictracer, urllib3, certifi, requests, lightstep, sf-xray-python-opentracing, khan, scipy, scikit-learn, sklearn, enum34, catboost
Running setup.py install for ujson: started
Running setup.py install for ujson: finished with status 'done'
Running setup.py install for httptools: started
Running setup.py install for httptools: finished with status 'done'
Running setup.py install for bosch: started
Running setup.py install for bosch: finished with status 'done'
Running setup.py install for wrapt: started
Running setup.py install for wrapt: finished with status 'done'
Running setup.py install for backoff: started
Running setup.py install for backoff: finished with status 'done'
Running setup.py install for thrift: started
Running setup.py install for thrift: finished with status 'done'
Running setup.py install for googleapis-common-protos: started
Running setup.py install for googleapis-common-protos: finished with status 'error'
Complete output from command /usr/local/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-gxmud83j/googleapis-common-protos/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-o_j5p0jb-record/install-record.txt --single-version-externally-managed --compile:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 10, in <module>
from setuptools.extern.six.moves import filter, filterfalse, map
File "/usr/local/lib/python3.6/site-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3017, in <module>
@_call_aside
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3045, in _initialize_master_working_set
dist.activate(replace=False)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2577, in activate
declare_namespace(pkg)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2151, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2091, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/usr/local/lib/python3.6/site-packages/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'
----------------------------------------
Command "/usr/local/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-gxmud83j/googleapis-common-protos/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-o_j5p0jb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-gxmud83j/googleapis-common-protos/
You are using pip version 9.0.1, however version 19.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
@yanst001 This is a bug in older pip / setuptools: please update your virtualenv via:
$ pip install --upgrade setuptools pip
@yanst001 This is a bug in older pip / setuptools: please update your virtualenv via:
$ pip install --upgrade setuptools pipMy pip is already at the current version (as listed on the top) upgrade setuptools still not work for this case. set setuptools==34.3.0 or 31.0 does not either
pip 19.0.2
setuptools 40.8.0
virtualenv 16.0.0
@yanst001 Trying to reproduce in a fresh virtual environment:
$ python3.6 -m venv /tmp/gcp/7386/
$ /tmp/gcp/7386/bin/pip install --upgrade setuptools pip
...
Successfully installed pip-19.0.2 setuptools-40.8.0
$ /tmp/gcp/7386/bin/pip install google-cloud-datastore
...
Successfully installed cachetools-3.1.0 certifi-2018.11.29 chardet-3.0.4 google-api-core-1.7.0 google-auth-1.6.3 google-cloud-core-0.29.1 google-cloud-datastore-1.7.3 googleapis-common-protos-1.5.8 grpcio-1.18.0 idna-2.8 protobuf-3.6.1 pyasn1-0.4.5 pyasn1-modules-0.2.4 pytz-2018.9 requests-2.21.0 rsa-4.0 six-1.12.0 urllib3-1.24.1
$ /tmp/gcp/7386/bin/pip freeze
-f ...
cachetools==3.1.0
certifi==2018.11.29
chardet==3.0.4
google-api-core==1.7.0
google-auth==1.6.3
google-cloud-core==0.29.1
google-cloud-datastore==1.7.3
googleapis-common-protos==1.5.8
grpcio==1.18.0
idna==2.8
protobuf==3.6.1
pyasn1==0.4.5
pyasn1-modules==0.2.4
pytz==2018.9
requests==2.21.0
rsa==4.0
six==1.12.0
urllib3==1.24.1
I get the same result if I use the virtualenv script.
@yanst001 Perhaps one of the already-installed packages uses the google namespace, but does so incorrectly (I.e., doesn't declare it properly as a namespace package)? Can you show the pip install line which you typed to provoke the traceback above?
@tseaver Thanks for trying to replicate the env. just realized my issue is different from my local environment.
Most helpful comment
@yanst001 This is a bug in older pip / setuptools: please update your virtualenv via: