skip to Main Content

I’m trying to upgrade pip to the latest version on Python 2.7.5 on Centos 7.

# python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/9e/24/bc928987f35dd0167f21b13a1777c21b9c5917c9894cff93f1c1a6cb8f3b/pip-21.0.tar.gz
    Complete output from command python setup.py egg_info:
    /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-eMN0xl/pip/setup.py", line 85, in <module>
        python_requires='>=3.6',
      File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__
        _Distribution.__init__(self,attrs)
      File "/usr/lib64/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 302, in finalize_options
        ep.load()(self, ep.name, value)
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2302, in load
        return self.resolve()
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2312, in resolve
        raise ImportError(str(exc))
    ImportError: 'module' object has no attribute 'check_specifier'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-eMN0xl/pip/

I tried upgrading the setup tools as well. However that’s failing to

# python -m pip install --upgrade setuptools

Collecting setuptools
 Using cached https://files.pythonhosted.org/packages/84/48/5c99d8770fd0a9eb0f82654c3294aad6d0ba9f8600638c2e2ad74f2c5d52/setuptools-52.0.0.tar.gz
   Complete output from command python setup.py egg_info:
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "setuptools/__init__.py", line 16, in <module>
       import setuptools.version
     File "setuptools/version.py", line 1, in <module>
       import pkg_resources
     File "pkg_resources/__init__.py", line 1367
       raise SyntaxError(e) from e
                               ^
   SyntaxError: invalid syntax
   
   ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ohx4SA/setuptools/

This was working will as of last Friday. However it seems to be broken from the beginning of this week.

Could you please advise on this?

3

Answers


  1. Chosen as BEST ANSWER

    Looks like they have removed support for Python 2.7 with the latest version of Pip.

    https://lwn.net/Articles/843945/

    If I pin the pip version to 20.3.4, it works fine.


  2. use wget

    wget https://bootstrap.pypa.io/get-pip.py
    sudo python get-pip.py
    
    Login or Signup to reply.
  3. I have upgraded my pip to 20.3.4 version using this command. If you decited to stay on Python2.7 so you can upgrade your pip till 20.3.4

    sudo python2.7 -m pip install --upgrade pip==20.3.4
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search