Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: '_NamespacePath' object has no attribute 'sort' #2990

Closed
Rockyyost opened this issue Feb 9, 2017 · 53 comments
Closed

AttributeError: '_NamespacePath' object has no attribute 'sort' #2990

Rockyyost opened this issue Feb 9, 2017 · 53 comments
Assignees

Comments

@Rockyyost
Copy link

Rockyyost commented Feb 9, 2017

  1. Ubuntu 16.04.1 LTS
  2. Python 3.5.2 :: Anaconda 4.2.0 (64-bit)

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'
@dhermes
Copy link
Contributor

dhermes commented Feb 9, 2017

@Rockyyost This error is 100% in pip. It seems you have a broken version of pip.

@dhermes
Copy link
Contributor

dhermes commented Feb 9, 2017

I'm pre-emptively closing but happy to re-open if more information arises.

@dhermes dhermes closed this as completed Feb 9, 2017
@theacodes
Copy link
Contributor

theacodes commented Feb 9, 2017 via email

@daspecster
Copy link
Contributor

Not sure if this is related pypa/setuptools#885 (comment).

@lukesneeringer
Copy link
Contributor

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.

@lukesneeringer lukesneeringer reopened this Feb 9, 2017
@lukesneeringer
Copy link
Contributor

lukesneeringer commented Feb 9, 2017

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.

@naveg
Copy link

naveg commented Feb 24, 2017

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

@tseaver
Copy link
Contributor

tseaver commented Feb 24, 2017

@naveg Thanks for updating with the workaround you found!

@lukesneeringer
Copy link
Contributor

Yeah, my problem turned out to be unrelated and I forgot about this ticket. Re-closing.

@MarSoft
Copy link

MarSoft commented Mar 2, 2017

Workaround / Fix

pip install --upgrade pip setuptools

With setuptools==34.3.0 the problem is no longer there.

@MarcelTon
Copy link

MarcelTon commented Apr 12, 2017

@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'

@bkleef
Copy link

bkleef commented May 9, 2017

Looks highly related to pypa/pip#4216.

@dhermes
Copy link
Contributor

dhermes commented May 9, 2017

@bkleef Indeed these are the same issue. The fix is a simple one: update setuptools

@bkleef
Copy link

bkleef commented May 9, 2017

@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

@dhermes
Copy link
Contributor

dhermes commented May 9, 2017

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.

@sandys
Copy link

sandys commented May 27, 2017

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)

@dhermes
Copy link
Contributor

dhermes commented May 30, 2017

@jonparrott Was there some pip / setuptools hiccup over the weekend that I missed by going off the grid?

@duggelz
Copy link

duggelz commented May 30, 2017 via email

@sree-kumar
Copy link

I can't even upgrade pip as the same error shows when trying
pip install --upgrade pip
in Windows 10.

@dhermes
Copy link
Contributor

dhermes commented Jul 19, 2017

@sree-kumar Check out get-pip.py

@dhermes
Copy link
Contributor

dhermes commented Oct 3, 2017

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:

@farridav
Copy link

@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)

@farridav
Copy link

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

@yanst001
Copy link

Python 3.6.5,
pip 19.0.2,
setuptools 40.8.0

I've also tried pip install --upgrade google-cloud-datastore and pip 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.

@motifiy
Copy link

motifiy commented Mar 25, 2019

值得注意的是,您只需要更新您的pip和setuptools。
...
2017年2月8日星期三,晚上8:55 Danny Hermes @.***>写道:我已经先发制人,但如果有更多信息,我很乐意重新开放。 - 您收到此消息是因为您订阅了此主题。直接回复此电子邮件,在GitHub上查看< #2990(评论) >,或将线程静音< https://github.com/notifications/unsubscribe-auth/AAPUc4exjr5-VpkrvSjWyZD0XQGw51ioks5rapwqgaJpZM4L7sYe >。

that can't sovle

@istemihan90
Copy link

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.

@foxmadr
Copy link

foxmadr commented Jun 18, 2019

I found a workaround:
$ pip uninstall setuptools
$ pip install setuptools==39.1.0

@oldmonkABA
Copy link

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

@yselivonchyk
Copy link

Faced same issue while building Tensorflow=1.14.1 under virtualenv. @oldmonkABA solution worked for me. Changed setuptools verion from 41 to 39.1

@motifiy
Copy link

motifiy commented Aug 6, 2019

差不多2年了,仍然没有人能找到解决方案。我尝试了这里提到的所有东西,但没有运气。我会特意放弃python。

don't try to giving up

@souschefistry
Copy link

easy_install pip followed by
pip install --upgrade pip && pip install --upgrade setuptools worked for me

@bikramkhastgir
Copy link

$ 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

@aisha-abdool
Copy link

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

@Anatolist
Copy link

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.

@lvZic
Copy link

lvZic commented May 27, 2020

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.

degrade setuptool just as @bikramkhastgir said

@lvZic
Copy link

lvZic commented May 27, 2020

$ 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

tchaikov added a commit to tchaikov/ceph that referenced this issue Dec 11, 2020
on certain distros, buggy pip and setuptools are used, so we need to
upgrade them first.

see also: googleapis/google-cloud-python#2990 and pypa/setuptools#885

Signed-off-by: Kefu Chai <kchai@redhat.com>
jmolmo pushed a commit to jmolmo/ceph that referenced this issue Dec 14, 2020
on certain distros, buggy pip and setuptools are used, so we need to
upgrade them first.

see also: googleapis/google-cloud-python#2990 and pypa/setuptools#885

Signed-off-by: Kefu Chai <kchai@redhat.com>
@Lexxos
Copy link

Lexxos commented Oct 16, 2021

how to fix : Command "python setup.py egg_info" failed with error code

Ubuntu: use apt
Centos 7: use yum

problem should not occur on centos 8, or versions later than Ubuntu 18.

This should allow python3 to fix your pip2 setup tools:

Ubuntu:
sudo apt install python3
sudo python3 -m pip install -U pip
sudo python3 -m pip install -U setuptools
pip install --upgrade pip

uninstall and reinstall directions at the end

Centos 7:
sudo yum install python3
sudo python3 -m pip install -U pip
sudo python3 -m pip install -U setuptools
pip install --upgrade pip

uninstall and reinstall directions at the end


If for some reason it's still broken (because not only are there different flavors, each cloud has their own flavor of a flavor):

sudo apt-get update
curl -sS https://bootstrap.pypa.io/get-pip.py >>setup.py
python3 setup.py

____ don't try anything yet, read on past yum____

yum update -y
curl -sS https://bootstrap.pypa.io/get-pip.py >>setup.py
python3 setup.py


after the installation, most will have this error: WARNING: The scripts PIP_X are installed in '/usr/local/bin' which is not on PATH, and if you try to:

export PATH=$PATH:/usr/local/bin
It MIGHT not work, if it does, do not do this next step: so now you have edit a file:

sudo nano /etc/environment

make sure this is added (also, if you don't have a fresh install, I will not know where else your installations are, so if you have any other paths, add them to the list by adding a : at the end before the quotation end.

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"

FINAL STEPS:

pip install --upgrade pip

pip --version

It should now say (as of writing this)
$ pip 21.3 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)"

AND NOW:

remove the broken package
pip2 uninstall YOURPACKAGE

reinstall your package
pip install YOURPACKAGE

and export
export PATH=$PATH:/usr/local/lib/python3.6/site-packages

FOR FUTURE UPDATES, CHECK THE VERSION PYTHON IS USING, SOMEDAY IT WILL BE 4.

@googleapis googleapis locked as resolved and limited conversation to collaborators Oct 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests