Comments (5)
Hello @clovisp, Thank you for creating this issue once again. This is expected behavior because you are using cache: pip without installing any dependencies. We were able to reproduce the issue on versions 5.2.0, 5.1.1, and 4 without adding the pip installation because pip hasn't cached any packages yet, so the cache directory doesn't exist.
The setup-python action sets up a Python environment, but it does not create a pip cache directory by default. The pip cache directory is created when pip installs a package and needs to cache it.
We tested the same scenario by adding the pip installation job, and the pip cache file was generated in the /home/runner/.cache/pip location, caching the installed packages.
To fix the issue, please consider the following possibilities:
1.Install dependencies: Make sure all required dependencies are installed and committed.
2.Do not use cache: pip: If there are no dependencies to cache, remove the cache: pip configuration from your GitHub Actions workflow.
If the issue stills continues from your end, Can you please share the workflow runs of v5.1.1 and v5.2.0 to check and assist.
Please find the workflow snippet and screenshots for reference.
testjobv5_2_0:
name: test cache pip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
python-version: 3.11
architecture: x64
cache: "pip"
testjobv_5_1_1:
name: test cache pip for v5.1.1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
python-version: 3.11
architecture: x64
cache: "pip"
testjobv_4:
name: test cache pip for v4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: x64
cache: "pip"
To fix the issue
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
architecture: x64
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
from setup-python.
I see this within my own workflows exactly as reported. I used the same pin-to-5.1.1 workaround (but removing the cache: pip
worked too). Related to #436?
from setup-python.
I don't know how common is the approach with the separate actions/cache for the venv, but perhaps add it as a question for the Issue template?
@kamilkrzyskow we use uv
(speed vs pip
), and we also cache the venv separately (also for speed).
from setup-python.
Hello @clovisp,
Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.
from setup-python.
Thanks @aparnajyothi-y,
without your explanation I would likely not find the cause, even though it was dead obvious.
Here is an example workflow run with the issue:
So basically there is a separate venv
cache managed with a different cache-key via actions/cache
.
From various tests, which I've done in the past, this approach decreases the displayed workflow execution time, as downloading and unpacking the cached venv directory is faster than reinstalling various wheel files from the pip cache itself.
This can also be observed in the workflow above.
Due to the change in 5.2.0, which added the architecture to the cache-key, the "uses: actions/setup-python" step can't find any previous caches. This is because the arch
was added in the middle of the key instead of the end so the "hashless" key doesn't act as the prefix for older keys.
Debug from the above workflow:
##[debug]["setup-python-Linux-x64-22.04-Ubuntu-python-3.12.5-pip-f3ce5f0aeb583ae252b72dd2e91cf415d92a0ca6eeade0b7caebd9ed7fdd3943","setup-python-Linux-x64-22.04-Ubuntu-python-3.12.5-pip"]
example of a previous key:
setup-python-Linux-22.04-Ubuntu-python-3.12.5-pip-f3ce5f0aeb583ae252b72dd2e91cf415d92a0ca6eeade0b7caebd9ed7fdd3943
Some final comments:
- Some people might consider this a breaking change, as it makes previous cache keys incompatible.
- I don't know how common is the approach with the separate actions/cache for the venv, but perhaps add it as a question for the Issue template?
- I think
pip cache is not found
message could be expanded with afor cache key: detected-key-hash...
, without the user needing to enable debugging.
EDIT: Forgot to mention, my solution was to delete the latest separate venv cache, and rerun the failing jobs to execute pip install
EDIT2: Actually changing the position of the arch
inside the cache-key won't change the situation, because the "hashless" key would still not have a matching base prefix with the older cache keys. My mistake with a too quick conclusion.
from setup-python.
Related Issues (20)
- setup-python computes wrong cache hash key, restores wrong cache HOT 5
- Python Version 3.9.2 was not found in the local cache HOT 2
- Python 3.12.5 missing HOT 3
- This issue was invalid HOT 2
- macOS package installation fails for non-privileged user HOT 1
- Missing Windows Installers for Python 3.9.x Versions Post-3.9.13 HOT 2
- submit Pull request HOT 2
- feature request needs triage HOT 1
- `python-version` is ignored on MacOS runners HOT 3
- PIP_ROOT_USER_ACTION=ignore ignored: pip still issues error messages about running it as root HOT 3
- Failure to extract Python archive on new Windows ARM ARM64 Github-hosted runner (Python 3.11 and 3.12) HOT 5
- What if I need to cache both pip and pipenv, is that possible? HOT 1
- Failure to parse pyproject.toml file when run on Windows HOT 7
- PyPy3.10 is v7.3.16 not the latest v7.3.17 HOT 6
- Permission denied when using os: self-hosted HOT 4
- Poetry cache docs are incorrect HOT 5
- Python based commands are no longer in PATH when using login shell on MacOS with Python 3.9-3.11 HOT 5
- Python version '3.11.9' not found on Debian 12 HOT 2
- Python 3.10 on macos-latest fails with error '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from setup-python.