-3

we try to install the latest version of pip by the following ( we have rhel 7.6 server with python 2.7 )

yum install python27-python-pip
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
rhel-7-server-rpms                                                                                                                                                    | 3.5 kB  00:00:00
rhel-server-rhscl-7-rpms                                                                                                                                              | 3.4 kB  00:00:00
(1/6): rhel-7-server-rpms/7Server/x86_64/group                                                                                                                        | 631 kB  00:00:00
(2/6): rhel-7-server-rpms/7Server/x86_64/updateinfo                                                                                                                   | 3.9 MB  00:00:01
(3/6): rhel-server-rhscl-7-rpms/7Server/x86_64/group                                                                                                                  |  124 B  00:00:00
(4/6): rhel-server-rhscl-7-rpms/7Server/x86_64/updateinfo                                                                                                             | 1.1 MB  00:00:00
(5/6): rhel-server-rhscl-7-rpms/7Server/x86_64/primary_db                                                                                                             | 6.0 MB  00:00:07
(6/6): rhel-7-server-rpms/7Server/x86_64/primary_db                                                                                                                   |  75 MB  00:00:11
Resolving Dependencies
--> Running transaction check
---> Package python27-python-pip.noarch 0:8.1.2-3.el7 will be installed
--> Processing Dependency: python27-python(abi) = 2.7 for package: python27-python-pip-8.1.2-3.el7.noarch
--> Processing Dependency: /opt/rh/python27/root/usr/bin/python2 for package: python27-python-pip-8.1.2-3.el7.noarch
--> Processing Dependency: python27-python-setuptools for package: python27-python-pip-8.1.2-3.el7.noarch
--> Processing Dependency: python27-runtime for package: python27-python-pip-8.1.2-3.el7.noarch
--> Running transaction check
---> Package python27-python.x86_64 0:2.7.17-2.el7 will be installed
--> Processing Dependency: python27-python-libs(x86-64) = 2.7.17-2.el7 for package: python27-python-2.7.17-2.el7.x86_64
---> Package python27-python-setuptools.noarch 0:0.9.8-7.el7 will be installed
---> Package python27-runtime.x86_64 0:1.1-26.1.el7 will be installed
--> Running transaction check
---> Package python27-python-libs.x86_64 0:2.7.17-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                               Arch                              Version                                   Repository                                           Size
=============================================================================================================================================================================================
Installing:
 python27-python-pip                                   noarch                            8.1.2-3.el7                               rhel-server-rhscl-7-rpms                            1.7 M
Installing for dependencies:
 python27-python                                       x86_64                            2.7.17-2.el7                              rhel-server-rhscl-7-rpms                             87 k
 python27-python-libs                                  x86_64                            2.7.17-2.el7                              rhel-server-rhscl-7-rpms                            5.8 M
 python27-python-setuptools                            noarch                            0.9.8-7.el7                               rhel-server-rhscl-7-rpms                            400 k
 python27-runtime                                      x86_64                            1.1-26.1.el7                              rhel-server-rhscl-7-rpms                            1.1 M

Transaction Summary
=============================================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 9.1 M
Installed size: 34 M
Is this ok [y/d/N]: n

since yum from rhel repo download very old version 8.1.x

then we try from epel repo as the following

yum  install python-pip
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
epel/x86_64/metalink                                                                                                                                                  |  22 kB  00:00:00
epel                                                                                                                                                                  | 4.7 kB  00:00:00
(1/3): epel/x86_64/group_gz                                                                                                                                           |  95 kB  00:00:00
epel/x86_64/updateinfo         FAILED
https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/repodata/26aa3fe31b7a3b4fd3c1865e5a8635f296b1a9c3591a936744c4226a7b170089-updateinfo.xml.bz2: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

(2/3): epel/x86_64/updateinfo                                                                                                                                         | 1.0 MB  00:00:00
(3/3): epel/x86_64/primary_db                                                                                                                                         | 6.9 MB  00:00:11
Resolving Dependencies
--> Running transaction check
---> Package python2-pip.noarch 0:8.1.2-14.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                         Arch                                       Version                                           Repository                                Size
=============================================================================================================================================================================================
Installing:
 python2-pip                                     noarch                                     8.1.2-14.el7                                      epel                                     1.7 M

Transaction Summary
=============================================================================================================================================================================================
Install  1 Package

Total download size: 1.7 M
Installed size: 7.2 M
Is this ok [y/d/N]: n

but again also from epel repo we have very old pip version - 8.1.2

so is it something with my procedure that is wrong?

if yes then how to install the latest pip version ?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
yael
  • 12,598
  • 51
  • 169
  • 303
  • Does this help you answer your question? https://unix.stackexchange.com/questions/567964/what-is-the-correct-way-to-upgrade-pip-in-stretch-debian – einfeyn496 Oct 11 '20 at 17:05
  • since I am using the approach of - python setup.py install , then this link isnt relevant – yael Oct 11 '20 at 17:14

2 Answers2

3

You are doing nothing wrong, 8.1.2 is the newest version of pip available in the EPEL 7 repo. RHEL/CentOS 7 usually doesn't get new versions of software, only bugfixes, and same applies to EPEL. There are some CVE fixes and other recent patches in the pip EPEL repo so I'd assume it's being actively maintained and safe to use.

Vojtech Trefny
  • 16,922
  • 6
  • 24
  • 48
  • so in that case which approach you are recommended to install the latest version like 21.x – yael Oct 11 '20 at 16:48
  • You need to install it manually -- [download the tarball](https://pypi.org/project/pip/20.2.3/#files), extract it somewhere and run `(sudo) python2 setup.py install`. It's not guaranteed to work, but it's most likely the only way if you really need newest pip (I still think the newest version shouldn't be needed, but that's up to you). – Vojtech Trefny Oct 11 '20 at 17:16
  • which approach is better - pip-20.2.3-py2.py3-none-any.whl OR pip-20.2.3.tar.gz ?? – yael Oct 11 '20 at 17:18
  • For manual installation, you'll need the `.tar.gz` file. – Vojtech Trefny Oct 11 '20 at 17:20
  • this link - https://pypi.org/project/pip/20.2.3/#files , is for both python versions? - 2.7 and 3.x ? ( or for 3.x maybe there are other pip versions? ) – yael Oct 11 '20 at 17:21
  • Yes, it is both python2 and python 3. – Vojtech Trefny Oct 11 '20 at 18:14
3

8.1.2 is the latest version that's available in the RHEL repos for RHEL 7.6 (and also RHEL 7.8) for the corresponding version of Python which is 2.7. Version 19.3.1 is available but it's for Python 3.8. You can see it available if you enable the necessary RHEL repos and search for the package with yum:

subscription-manager repos enable rhel*
yum list available | grep python-pip

That will show you the latest versions for all of the available versions of Python including 8.1.2 for Python 2.7 and 19.3.1 for Python 3.8.

If you want version 21.x, then you need to install a later version of Python such as 3.8. Python 2.7 is no longer supported and won't receive anymore updates.

Nasir Riley
  • 10,665
  • 2
  • 18
  • 27
  • so in that case which approach you are recommended to install the latest version like 21.x – yael Oct 11 '20 at 16:48
  • can we use the version pip - 21.x for python 2.7? – yael Oct 11 '20 at 16:52
  • 1
    @yael No. Python version 20.2.3 is the last available version for Python 2.7 which isn't supported anymore. Pip will no longer receive updates for 2.7 which means no 21.x. You can find this information on Python's website. You can upgrade pip itself to it's latest version but not from the repos; however, there's no reason to do so. Pip doesn't really need to be upgraded. – Nasir Riley Oct 11 '20 at 16:55
  • so if I installed also python 3.x additionally to python 2,7 then how to alignment the pip for each python version ? – yael Oct 11 '20 at 17:00
  • @yael Install `pip` for the respective version of Python and prepend them to your `PATH`. You should know how to do this. – Nasir Riley Oct 11 '20 at 17:46