8000 Failure to install older pip versions (24.2) where 25.1 is the default when actions/cache@v4 hit a cache · Issue #1101 · actions/setup-python · GitHub
[go: up one dir, main page]

Skip to content

Failure to install older pip versions (24.2) where 25.1 is the default when actions/cache@v4 hit a cache #1101

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

Closed
2 of 5 tasks
shachafl opened this issue May 7, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@shachafl
Copy link
shachafl commented May 7, 2025

Description:
Workflow failure after getting error (see below) when trying to install a specific pip version. The same workflow worked without issues about 3 weeks ago, and no new changes were made on my end.
In this iteration, it worked once when no cache was used.
Now fails every time when Run actions/cache@v4 hit a cache.

Action version:
'actions/checkout@v4' (SHA:11bd71901bbe5b1630ceea73d27597364c9af683)
'actions/setup-python@v5' (SHA:a26af69be951a213d495a4c3e4e4022e16d87065)
'actions/cache@v4' (SHA:5a3ec84eff668545956fd18022155c47e93e2684)

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

Repro steps:
https://github.com/spacetx/starfish/actions/runs/14877629662/job/41778019051?pr=2063

Expected behavior:
python -m pip install --upgrade pip==24.2
Collecting pip==24.2
Downloading pip-24.2-py3-none-any.whl.metadata (3.6 kB)
Downloading pip-24.2-py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 28.2 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 25.0.1
Uninstalling pip-25.0.1:
Successfully uninstalled pip-25.0.1
Successfully installed pip-24.2

Actual behavior:
python -m pip install --upgrade pip==24.2

Notice: A new release of pip is available: 24.2 -> 25.1.1
Notice: To update, run: pip install --upgrade pip
ERROR: Exception:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 105, in _run_wrapper
status = _inner_run()
File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 96, in _inner_run
return self.run(options, args)
File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
return func(self, options, args)
File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 363, in run
resolver = self.make_resolver(
File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 175, in make_resolver
import pip._internal.resolution.resolvelib.resolver
File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 8, in
from pip._vendor.resolvelib import BaseReporter, ResolutionImpossible
File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_vendor/resolvelib/init.py", line 19, in
from .resolvers import (
File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers/init.py", line 1, in
from ..structs import RequirementInformation
ImportError: cannot import name 'RequirementInformation' from 'pip._vendor.resolvelib.structs' (/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/pip/_vendor/resolvelib/structs.py)

@priyagupta108
Copy link
Contributor

Hello @shachafl 👋,
Thank you for your report. We'll investigate the issue and get back to you with the details!

@shachafl
Copy link
Author
shachafl commented May 8, 2025

In my case, I was able to circumvent the error by manually deleting the cache (via the website) and updating my pip version to 25.1 (It was fixed to 24.2) prior to any dependency installation.

@priyagupta108
Copy link
Contributor

Hi @shachafl 👋,
The issue is caused by a conflict between the cached Python environment and the attempt to downgrade pip to version 24.2, while the setup-python action installs the latest version by default (currently 25.1). This discrepancy can cause compatibility issues if the cached environment includes dependencies or configurations tied to a different version of pip.
Here are a few recommended solutions:

  1. Use the Latest pip Version:
    If your project doesn’t require a specific version of pip, consider using the latest version (currently 25.1) to avoid potential conflicts with cached dependencies. This approach eliminates the need for managing multiple versions and ensures compatibility with the latest packages.


  2. Explicit pip Version Management:
    To avoid version conflicts, install the required pip version (24.2) right after setup-python action. This ensures the environment aligns with workflow expectations:

steps:
  ...

  - name: Set up Python
    uses: actions/setup-python@v5
    with:
      python-version: '3.9'

  - name: Install specific pip version
    run: python -m pip install --upgrade pip==24.2

  - name: Restore cache
    uses: actions/cache@v4
    with:
      path: ${{ env.pythonLocation }}
      key: ${{ runner.OS }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/REQUIREMENTS-CI.txt') }}

Let us know if this resolves the issue or if you need any further assistance!

@shachafl
Copy link
Author

Thank you @priyagupta108 for the detailed explanation.
I have used option (1) to resolve my case, but good to know about option (2) for future reference.

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

2 participants
0