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

Not able to upgrade pip from python3-pip package in Azure Linux 3 #10867

Open
bebound opened this issue Oct 29, 2024 · 6 comments
Open

Not able to upgrade pip from python3-pip package in Azure Linux 3 #10867

bebound opened this issue Oct 29, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@bebound
Copy link

bebound commented Oct 29, 2024

Describe the bug
Not able to use python3 -m pip install -U pip to upgrade pip from python3-pip package in Azure Linux 3.

I'm able to do so in Mariner2.0 and other distros.

To Reproduce
Steps to reproduce the behavior:

  1. tdnf install python3-pip
  2. python3 -m pip install -U pip

Expected behavior
Update pip

Screenshots

root [ / ]# python3 -m pip install -U pip
Requirement already satisfied: pip in /usr/lib/python3.12/site-packages (24.2)
Collecting pip
  Downloading pip-24.3.1-py3-none-any.whl.metadata (3.7 kB)
Downloading pip-24.3.1-py3-none-any.whl (1.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 5.7 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 24.2
error: uninstall-no-record-file

× Cannot uninstall pip 24.2
╰─> The package's contents are unknown: no RECORD file was found for pip.

hint: The package was installed by rpm. You should check if it can uninstall the package.
@zcobol
Copy link

zcobol commented Oct 29, 2024

@bebound pip install --upgrade --ignore-installed pip works:

zcobol@azure-166 [ ~ ]$ sudo pip install --upgrade pip
Requirement already satisfied: pip in /usr/lib/python3.12/site-packages (24.2)
Collecting pip
  Using cached pip-24.3.1-py3-none-any.whl.metadata (3.7 kB)
Using cached pip-24.3.1-py3-none-any.whl (1.8 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 24.2
error: uninstall-no-record-file

× Cannot uninstall pip 24.2
╰─> The package's contents are unknown: no RECORD file was found for pip.

hint: The package was installed by rpm. You should check if it can uninstall the package.

and with --ignore-installed argument:

zcobol@azure-166 [ ~ ]$ sudo pip install --upgrade --ignore-installed pip
Collecting pip
  Using cached pip-24.3.1-py3-none-any.whl.metadata (3.7 kB)
Using cached pip-24.3.1-py3-none-any.whl (1.8 MB)
Installing collected packages: pip
Successfully installed pip-24.3.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
zcobol@azure-166 [ ~ ]$ pip list
Package    Version
---------- -------
pip        24.3.1
setuptools 69.0.3

@bebound
Copy link
Author

bebound commented Oct 30, 2024

--ignore-installed does not remove the files from 24.2. It only overwrites the files in new version.

This might be a workaround, but the usual method to upgrade a package is to uninstall the previous version and install the new one.

@elsaco
Copy link

elsaco commented Oct 30, 2024

The python3-pip RPM package is missing the RECORD file. However, PEP 627 states that the RECORD file is optional:

The RECORD file is made optional. Not all tools can easily generate a list of installed files
in a Python-specific format.

Specifically, the RECORD file is unnecessary when projects are installed by a Linux system packaging system,
which has its own ways to keep track of files, uninstall them or check their integrity. Having to keep a RECORD
file in sync with the disk and the system package database would be unreasonably fragile, and no RECORD file
is better than one that does not correspond to reality.

More info at https://peps.python.org/pep-0627/#optional-record-file

Because the INSTALLER file is present but no RECORD the rpm tool doesn't know what to uninstall, thus the error. More info about the error message:

When dist-info/INSTALLER is present and contains some useful information,
the info is included in the error message instead:

ERROR: Cannot uninstall foobar 0.1, RECORD file not found. Hint: The package was installed by rpm.

@annapankiewicz
Copy link
Member

+1, also running into this.

##[error]#6 [6/8] RUN python3 -m pip install --upgrade pip
##[error]#6 0.795 Looking in indexes: https://build:***@pkgs.dev.azure.com/*******/*******/_packaging/*******/pypi/simple
##[error]#6 0.795 Requirement already satisfied: pip in /usr/lib/python3.12/site-packages (24.2)
##[error]#6 0.994 Collecting pip
##[error]#6 1.127   Downloading https://pkgs.dev.azure.com/*******/*******/_packaging/*******/pypi/download/pip/24.3.1/pip-24.3.1-py3-none-any.whl (1.8 MB)
##[error]#6 1.190 Installing collected packages: pip
##[error]#6 1.191   Attempting uninstall: pip
##[error]#6 1.194     Found existing installation: pip 24.2
##[error]#6 1.426 error: uninstall-no-record-file
##[error]#6 1.426 
##[error]#6 1.426 × Cannot uninstall pip 24.2
##[error]#6 1.426 ╰─> The package's contents are unknown: no RECORD file was found for pip.
##[error]#6 1.426 
##[error]#6 1.426 hint: The package was installed by rpm. You should check if it can uninstall the package.
##[error]#6 ERROR: process "/bin/sh -c python3 -m pip install --upgrade pip" did not complete successfully: exit code: 1
##[error]------
##[error] > [6/8] RUN python3 -m pip install --upgrade pip:
##[error]#6 1.190 Installing collected packages: pip
##[error]#6 1.191   Attempting uninstall: pip
##[error]#6 1.194     Found existing installation: pip 24.2
##[error]#6 1.426 error: uninstall-no-record-file
##[error]#6 1.426 
##[error]#6 1.426 × Cannot uninstall pip 24.2
##[error]#6 1.426 ╰─> The package's contents are unknown: no RECORD file was found for pip.
##[error]#6 1.426 
##[error]#6 1.426 hint: The package was installed by rpm. You should check if it can uninstall the package.
##[error]------
##[error]Dockerfile:39

@jperrin
Copy link
Contributor

jperrin commented Dec 14, 2024

@annapankiewicz can you help me understand the need to update pip vs using what's provided?

@bebound
Copy link
Author

bebound commented Dec 16, 2024

@jperrin As described in the issue, what's the right way to upgrade the system pip?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants