-
Notifications
You must be signed in to change notification settings - Fork 569
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
Remove leftover pip-23.2.dist-info
in site-packages
#785
Comments
Transferring to setup-python as we do not maintain the hostedtoolcache archives, we only provide them as they are in the image |
Hello, @ezio-melotti ! Thank you for reporting this issue, we will look into it :) |
This bug causes problems with uv, because it expects (as python does too) that there is only one version per package (astral-sh/uv#1848 (comment)) #713 is a duplicate of this |
See actions/setup-python#785 Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
See actions/setup-python#785 Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
See actions/setup-python#785 Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
It looks like @mayeut created and merged a PR that superseded the one I made, and this should have fixed the issue:
There are a few releases in |
Hello @ezio-melotti, Closing this issue as this feature request is implemented in the merged PR. |
Description
While running a brand-new image, there are two
.dist-info
dirs forpip
:The first (
pip-23.2.1.dist-info
) belongs to thepip
version that was initially installed, the second (pip-23.3.2.dist-info
) to the updated version. Apparently this is becausepip
is updated using--ignore-installed
, which leaves behind the oldpip-23.2.1.dist-info
.Even though the latest version of
pip
is installed and used, the presence of the two dirs can create issues. For example, tools likesafety
detect the old version and report it since it has vulnerabilities, causing CI failures:Unless there is a valid reason to keep the old
.dist-info
around, I suggest removing the--ignore-installed
flag, so thatpip-23.2.1.dist-info
is automatically removed during thepip
update.Click to see the full analysis of the issue
This initially came up because of a CI failure triggered by
safety
which detected an old version ofpip
, even though we were running the latest version. This lead to this issue:To debug the issue, I created the following test PR:
pip
version in the linter CI. ezio-melotti/cherry-picker#1The output shows that the latest version of
pip
was installed from the beginning and correctly used by the other commands, but anls
shows 2.dist-info
dirs forpip
.To double-check, I created an empty workflow that only executes the
ls
, and the two.dist-info
are still present:pip
version on an empty runner ezio-melotti/cherry-picker#2I looked at the code of this repo to see how Python and
pip
where installed, and apparently it happens in:https://github.com/actions/runner-images/blob/266f9413d39fc77ade974757b633ef98873c9c21/images/ubuntu/scripts/build/Install-Toolset.ps1#L50C1-L51
This loop installs all the tools, including Python, from https://github.com/actions/python-versions
The code that actually installs Python and updates pip should be:
https://github.com/actions/python-versions/blob/af22c2b8e41acf6dc7c64030339622962820df9e/installers/nix-setup-template.sh#L51-L53
Here the
--ignore-installed
flag is used:I'm not sure if/why this is needed, but I verified locally that this flag leaves around the old
.dist-info
. When--ignore-installed
is not used, only a.dist-info
dir is present after the upgrade:When
--ignore-installed
is used, the oldpip-23.2.dist-info
dir is left behind after the upgrade:Removing
--ignore-installed
fromnix-setup-template.sh
should therefore fix the issue, assuming it is not needed for other reasons.Also note that the same flag is also used elsewhere, e.g. in
install-pypy.sh
.If my analysis is correct, I can prepare a PR (or more) to remove the
--ignore-installed
flag.Platforms affected
Runner images affected
Image version and build link
This was tested on the following image:
It likely affects other (all?) images.
See e.g. https://github.com/ezio-melotti/cherry-picker/actions/runs/7386618932/job/20093604056?pr=2
Is it regression?
No
Expected behavior
There should be only one version of
pip
installed, and only one.dist-info
dir that matches the installed version.Actual behavior
There are two
.dist-info
dirs.Repro steps
Run this workflow to check:
It will output this:
The text was updated successfully, but these errors were encountered: