I was trying install with pip install --upgrade google-cloud but I get the following AttributeError: '_NamespacePath' object has no attribute 'sort'
Below is the stack trace:
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/bin/pip", line 7, in <module>
from pip import main
File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
@_call_aside
File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/home/ubuntu/anaconda3/lib/python3.5/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'
@Rockyyost This error is 100% in pip. It seems you have a broken version of pip.
I'm pre-emptively closing but happy to re-open if more information arises.
Notably, you just need to update your pip & setuptools.
On Wed, Feb 8, 2017, 8:55 PM Danny Hermes notifications@github.com wrote:
I'm pre-emptively closing but happy to re-open if more information arises.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2990#issuecomment-278547215,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUc4exjr5-VpkrvSjWyZD0XQGw51ioks5rapwqgaJpZM4L7sYe
.
Not sure if this is related https://github.com/pypa/setuptools/issues/885#issuecomment-278652057.
I am re-opening; I think this might actually be an issue with the _current_ version of pip (as in, pip re-broke it), and I want to track it.
~Confirmed, this works with setuptools==34.0.0, broken in setuptools==34.1.1 (the current version).~ Not completely correct, but I still think it is a current problem.
Is there a workaround for this? I can't install google-cloud
Edit: pip install --upgrade pip and pip install --upgrade setuptools did the trick. Maybe this can be closed
@Naveg Thanks for updating with the workaround you found!
Yeah, my problem turned out to be unrelated and I forgot about this ticket. Re-closing.
pip install --upgrade pip setuptools
With setuptools==34.3.0 the problem is no longer there.
@MarSoft bit tricky in a chicken-egg kind of way:
# pip install --upgrade pip setuptools
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, 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'
Looks highly related to https://github.com/pypa/pip/issues/4216.
@bkleef Indeed these are the same issue. The fix is a simple one: update setuptools
@dhermes indeed but 9.0.2 is not yet on pypa and so you need to upgrade like:
pip install -I https://github.com/pypa/pip/archive/master.zip#egg=pip
I don't think the issue is present in the latest released version of setuptools (but I could be wrong). Also, you can update setuptools without updating pip.
we are facing the same issue on latest anaconda (and python 3.6.1) - we did the same thing as @bkleef and got it working (pip install)
@jonparrott Was there some pip / setuptools hiccup over the weekend that I missed by going off the grid?
It's been around a while. You might have to update setuptools separately from other packages and/or in a different order depending on what versions are currently installed.
I can't even upgrade pip as the same error shows when trying
pip install --upgrade pip
in Windows 10.
@sree-kumar Check out get-pip.py
For all those coming by, I have done a "deep" dive today to understand this issue and found out that pip==9.0.1 (current latest) still comes with a broken version of setuptools.
This '_NamespacePath' object has no attribute 'sort' error is unavoidable if you use python setup.py install on one of our packages (they are all namespace packages).
If you have a fresh environment and only use pip install to install our packages, you will not have this issue.
Sorry for the inconvenience.
References:
@dhermes I ended up here after going round the houses, though even with a "fresh" environment, and using pip for all package installtion there is still a problem, see:
python3.6 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools
pip install --upgrade google-cloud-datastore
pip freeze
Requirement already up-to-date: pip in ./.venv/lib/python3.6/site-packages
Collecting setuptools
Using cached setuptools-36.7.2-py2.py3-none-any.whl
Installing collected packages: setuptools
Found existing installation: setuptools 28.8.0
Uninstalling setuptools-28.8.0:
Successfully uninstalled setuptools-28.8.0
Successfully installed setuptools-36.7.2
...
Installing collected packages: ply, six, protobuf, idna, certifi, urllib3, chardet, requests, googleapis-common-protos, grpcio, future, dill, pyasn1, rsa, cachetools, pyasn1-modules, google-auth, google-gax, google-api-core, google-cloud-core, httplib2, oauth2client, proto-google-cloud-datastore-v1, gapic-google-cloud-datastore-v1, google-cloud-datastore
Running setup.py install for ply ... done
Running setup.py install for googleapis-common-protos ... done
Running setup.py install for future ... done
Running setup.py install for dill ... done
Running setup.py install for httplib2 ... done
Running setup.py install for oauth2client ... done
Running setup.py install for proto-google-cloud-datastore-v1 ... done
Running setup.py install for gapic-google-cloud-datastore-v1 ... done
Successfully installed cachetools-2.0.1 certifi-2017.11.5 chardet-3.0.4 dill-0.2.7.1 future-0.16.0 gapic-google-cloud-datastore-v1-0.15.3 google-api-core-0.1.1 google-auth-1.2.1 google-cloud-core-0.28.0 google-cloud-datastore-1.4.0 google-gax-0.15.16 googleapis-common-protos-1.5.3 grpcio-1.7.0 httplib2-0.10.3 idna-2.6 oauth2client-3.0.0 ply-3.8 proto-google-cloud-datastore-v1-0.90.4 protobuf-3.4.0 pyasn1-0.3.7 pyasn1-modules-0.1.5 requests-2.18.4 rsa-3.4.2 six-1.11.0 urllib3-1.22
Traceback (most recent call last):
File "/path/to/my/venv/bin/pip", line 7, in <module>
from pip import main
File "/path/to/my/venv/lib/python3.6/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/path/to/my/venv/lib/python3.6/site-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/path/to/my/venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
@_call_aside
File "/path/to/my/venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/path/to/my/venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/path/to/my/venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/path/to/my/venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/path/to/my/venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/path/to/my/venv/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'
The only way I have been able to get around it is to comment out the offending line in /path/to/my/venv/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py
Im still reading through to see what effect this will have, though im not going to be able to do that on my PAAS (flexible environment in appengine)
UPDATE, mines working with pip from bleeding edge, no steuptools upgrade (thanks @bkleef ):
python3.6 -m venv .venv
source .venv/bin/activate
pip install -I https://github.com/pypa/pip/archive/master.zip#egg=pip
pip install --upgrade google-cloud-datastore
pip freeze
Sorry to hear that @farridav, the sort() issue was resolved in https://github.com/pypa/pip/pull/4712 (pip had a much older version of pkg_resources / setuptools vendored in). This is why installing from bleeding edge resolves the issue.
I tried to reproduce your issue and could not. It's likely (almost certainly?) caused by a stray easy-install.pth in some site-packages directory that pip is searching through. Even when you use .venv/bin/pip, it may search some directories outside of .venv/lib/python3.6/site-packages.
ASIDE: You're the first person I've actually seen use python3.6 -m venv rather than python3.6 -m virtualenv.
ASIDE: I long ago stopped source-ing the activate script, because of the funky / unintended consequences. You'll have a much saner time just using the full paths, e.g. .venv/bin/python, .venv/bin/pip (and even .venv/bin/python -m pip could be considered "preferred").
I fixed the problem by commenting (or removing) the line: orig_path.sort(key=position_in_sys_path) [I think is line number 2066] both in "/usr/lib/python3/dist-packages/pkg_resources/__init__.py" and "~/.local/lib/python3.5/site-packages/pip/_vendor/__init.py__".
This problem has begun when I updated pip using "sudo pip --upgrade python-pip". I'm on Ubuntu 16.04 LTS.
I ran into this issue today when upgrading pip from 9.0.1 to 9.0.2 . I don't believe it is a setuptools issue as I upgraded to 39.0.0 . Eventually nothing would install. I went into pip and bypassed line 2121? (the keysorter line) and it works, although I have no idea if this will be stable.
Disappointing that this would be an issue 2 years out for a package as important as pip.
I also still have the problem, with the newest pip version.
Now also running in this error with easy_install
ImportError: No module named py31compat
Thanks @farridav. Your solution works for me to create virtual environment (as a replacement for Anaconda3/4.4.0 due to the issue) on HPC server for my account.
Currently experiencing this issue with the following setup
python 3.5.2
pip 18.0
virtualenv 15.0.1
setuptools 40.2.0
When installing google-cloud-bigquery setuptools fails to install googleapis-common-protos with the following error:
Running setup.py install for googleapis-common-protos ... error
Complete output from command /home/albert_wigmore/virtualenv/lstm_bq/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-fksxeztu/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-record-zn45uggk/install-record.txt --single-version-externally-managed --compile --install-headers /home/albert_wigmore/virtualenv/lstm_bq/include/site/python3.5/googleapis-common-protos:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/setuptools/__init__.py", line 14, in <module>
import setuptools.version
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2927, in <module>
@_call_aside
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2913, in _call_aside
f(*args, **kwargs)
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
add_activation_listener(lambda dist: dist.activate())
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 956, in subscribe
callback(dist)
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2952, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2515, in activate
declare_namespace(pkg)
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2097, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2047, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/home/albert_wigmore/virtualenv/lstm_bq/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
Seems the problem has been re-introduced with a newer version of setuptools which is confusing for anyone who finds this thread.
Temporary Fix: Downgrading setuptools to version 34.3.0 is mentioned by @MarSoft seems to fix this issue.
Updating pip and the setup tools did the work for me.
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
@khandelwal1998 Hi, I was having problems with installing pysam and constantly getting error code 1 while in my venv. This solved all my problems
Downgrading setuptools worked for
I also have the same problem when I use python3.5 to build tensorflow.But I user this command to resolve it.
pip3 install --user --upgrade pip setuptools
Neither upgrading pip nor upgrading setuptools helped :(.
Ediy - Sorry just realised this got posted in the wrong thread: my error is different I will post it elsewhere:
Same error whilst trying to pip install Gasp 0.4.5:
Command "python setup.py egg_info" failed with error code 1 in C:Users***App
DataLocalTemppip-install-q7skuluugasp
Upgraded pip, wheel and setuptools:
Successfully installed pip-18.0 setuptools-40.2.0 wheel-0.31.1
I tried downgrading setuptools to 34.3.0 as mentioned by AlbertWigmore & MarSoft above using:
python -m pip install setuptools==34.3.0 --user
and I got:
Successfully installed appdirs-1.4.3 packaging-17.1 pyparsing-2.2.0 setuptools-3
4.3.0 six-1.11.0
Any thoughts appreciated, I am pretty new to coding, python, etc. so it might have to be in pretty simple terms :)
Is there a workaround for this? I can't install
google-cloudEdit:
pip install --upgrade pipandpip install --upgrade setuptoolsdid the trick. Maybe this can be closed
Still not working for me
For what it's worth I was having this issue with googleapis-common-protos on Ubuntu 16.04 with the latest setuptools and pip using python3.6, but not on my Mac.
I was using a virtualenv and discovered that my Mac had virtualenv 15.1.0 and the Ubuntu had virtualenv 15.0.1 and that upgrading the virtualenv allowed the install to work.
I had the same problem using poetry.
Running
poetry run pip install --upgrade pip setuptools
instead of
pip install --upgrade pip setuptools
fixed the issue.
I have the same problem when i use python3.7.
I want to install pybloom use the following command:
pip install pybloom
error:
Command "python setup.py egg_info" failed with error code 1 in C:UsersyangxuAppDataLocalTemppip-install-652wx0k_pybloom
I have upgraded the pip and setuptools.
Python 3.6.5,
pip 19.0.2,
setuptools 40.8.0I've also tried
pip install --upgrade google-cloud-datastoreandpip install --upgrade googleapis-common-protos
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
However still have the issue, so I need to ask for solutions: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.
Please ignore this question, that is from a different issue other than my local env.
its been almost 2 years and still nobody could find a solution for this. I tried everything that are mentioned here but no luck. I will give up on python adventually.
I found a workaround:
$ pip uninstall setuptools
$ pip install setuptools==39.1.0
I found a workaround:
$ pip uninstall setuptools
$ pip install setuptools==39.1.0
For me setuptools-41.0.1 was giving the error. Downgrading it to 39.1.0 as mentioned solved the issue for python 3.6.7
Faced same issue while building Tensorflow=1.14.1 under virtualenv. @oldmonkABA solution worked for me. Changed setuptools verion from 41 to 39.1
差不多2年了,仍然没有人能找到解决方案。我尝试了这里提到的所有东西,但没有运气。我会特意放弃python。
don't try to giving up
easy_install pip followed by
pip install --upgrade pip && pip install --upgrade setuptools worked for me
$ pip install --upgrade setuptools==41.2.0
You dont need to downgrade setuptools to 39.1.0 from 41.0.1.
It works perfectly after upgrading to 41.2.0. @oldmonkABA @yselivonchyk
UPDATE, mines working with pip from bleeding edge, no steuptools upgrade (thanks @bkleef ):
python3.6 -m venv .venv source .venv/bin/activate pip install -I https://github.com/pypa/pip/archive/master.zip#egg=pip pip install --upgrade google-cloud-datastore pip freeze
Thank you so much. Finally worked for me after trying soooo many unsuccessful options. Thanks @bkleef
hello everyone, I had these specifications
Ubuntu: 16.04
Python3.5
TensorFlow: 2.0.0
When I run: pip3 install --upgrade setuptools
Requirement already up-to-date: setuptools in ./profile_env/lib/python3.5/site-packages (46.1.3)
And Sudo pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python3.5/dist-packages (20.1)
But when I run easy_install pip, I get the error:
Traceback (most recent call last):
File "/home/anatoli/profile_env/bin/easy_install", line 5, in <module>
from setuptools.command.easy_install import main
File "/home/anatoli/profile_env/lib/python3.5/site-packages/setuptools/__init__.py", line 17, in <module>
import setuptools.version
File "/home/anatoli/profile_env/lib/python3.5/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2927, in <module>
@_call_aside
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2913, in _call_aside
f(*args, **kwargs)
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
add_activation_listener(lambda dist: dist.activate())
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 956, in subscribe
callback(dist)
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2952, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2515, in activate
declare_namespace(pkg)
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2097, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2047, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
I went to change the __init__.py like the instruction above but It didn't work.
If there is any help, I would appreciate it.
hello everyone, I had these specifications
Ubuntu: 16.04
Python3.5
TensorFlow: 2.0.0When I run:
pip3 install --upgrade setuptools
Requirement already up-to-date: setuptools in ./profile_env/lib/python3.5/site-packages (46.1.3)And
Sudo pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python3.5/dist-packages (20.1)But when I run
easy_install pip, I get the error:
Traceback (most recent call last): File "/home/anatoli/profile_env/bin/easy_install", line 5, in <module> from setuptools.command.easy_install import main File "/home/anatoli/profile_env/lib/python3.5/site-packages/setuptools/__init__.py", line 17, in <module> import setuptools.version File "/home/anatoli/profile_env/lib/python3.5/site-packages/setuptools/version.py", line 1, in <module> import pkg_resources File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2927, in <module> @_call_aside File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2913, in _call_aside f(*args, **kwargs) File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set add_activation_listener(lambda dist: dist.activate()) File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 956, in subscribe callback(dist) File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2952, in <lambda> add_activation_listener(lambda dist: dist.activate()) File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2515, in activate declare_namespace(pkg) File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2097, in declare_namespace _handle_ns(packageName, path_item) File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2047, in _handle_ns _rebuild_mod_path(path, packageName, module) File "/home/anatoli/profile_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path orig_path.sort(key=position_in_sys_path) AttributeError: '_NamespacePath' object has no attribute 'sort'I went to change the init.py like the instruction above but It didn't work.
If there is any help, I would appreciate it.
degrade setuptool just as @bikramkhastgir said
$ pip install --upgrade setuptools==41.2.0
You dont need to downgrade setuptools to 39.1.0 from 41.0.1.
It works perfectly after upgrading to 41.2.0. @oldmonkABA @yselivonchyk
thank god for it
Most helpful comment
Is there a workaround for this? I can't install
google-cloudEdit:
pip install --upgrade pipandpip install --upgrade setuptoolsdid the trick. Maybe this can be closed