-
Notifications
You must be signed in to change notification settings - Fork 553
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
Post setup Python step fails (pipenv cache) #436
Comments
Hello @mrlubos. Thank you for your report. I've tried to reproduce the issue but everything works as expected. Could you please provide public repository to reproduce the issue ? |
@dmitry-shibanov Hi Dmitry, thank you for your reply! I might look into trying to reproduce this in a public repository if the issue persists, wanted to provide at least some pointers in the meantime in case anyone else runs into the same problem. Further behaviour I observed today is that even if the post setup step completes, the next run will show this message: Run actions/[email protected]
with:
cache: pipenv
python-version: [3](https://github.com/<org>/<repo>/runs/6896643828?check_suite_focus=true#step:5:3).9.13
token: ***
Successfully setup CPython (3.9.13)
pipenv cache is not found What I think might get us closer to the resolution is the fact I realised we've started experiencing these issues after upgrading from v2 to v3. That being said, the post step cache looks the same for both versions: v2 Post job cleanup.
Cache hit occurred on the primary key setup-python-Linux-python-3.9.13-pipenv-cbf9160[2](https://github.com/<org>/<repo>/runs/6766531090?check_suite_focus=true#step:18:2)ee5daeb2e69e4e65d32ca4c617d796670afbc226f170e9e4035d058e, not saving cache. v3 Post job cleanup.
/usr/bin/tar --posix --use-compress-program zstd -T0 -cf cache.tzst -P -C /home/runner/work/<repo>/<repo> --files-from manifest.txt
Cache Size: ~[2](https://github.com/<org>/<repo>/runs/6896643828?check_suite_focus=true#step:18:2)02 MB (212215749 B)
Cache saved successfully
Cache saved with the key: setup-python-Linux-python-[3](https://github.com/<org>/<repo>/runs/6896643828?check_suite_focus=true#step:18:3).9.13-pipenv-0c70[4](https://github.com/<org>/<repo>/runs/6896643828?check_suite_focus=true#step:18:4)b[5](https://github.com/<org>/<repo>/runs/6896643828?check_suite_focus=true#step:18:5)9407d6fda6f2722fa4daa27bc67f9d74da6402ee4c95f412a71936434 I would therefore expect the cache to be picked up by v3. I am shooting blanks here, would adding |
Thank you for your reply @mrlubos. I do not think that it's related to fetch depth. I'll try to reproduce the issue from my side one more time. If you have any updates feel free to post them here. |
Hi @dmitry-shibanov no updates beyond that this is still an issue. I tried removing the Run actions/[email protected]
with:
cache: pipenv
python-version: 3.9.13
token: ***
Successfully setup CPython (3.9.13)
pipenv cache is not found And then in post step Post job cleanup.
Error: Cache folder path is retrieved for pipenv but doesn't exist on disk: /home/runner/.local/share/virtualenvs |
@dmitry-shibanov So I am fairly confident this is happening only on the |
I was also seeing this when attempting to update to v4 (from v1!). After some head scratching, I found it was because of some remnants of my old manual caching system: env:
PIPENV_NOSPIN: 1
PIPENV_CACHE_DIR: /tmp/.pip-cache
WORKON_HOME: /tmp/pipenv-venvs Removing both cache location vars enables the "new" caching system to work as expected. |
Yeah @coldino it does sound like something similar is happening to me, except I don't have any variables set explicitly so it's not obvious whether this is something I can resolve on my end |
I am also seeing this issue. I upgraded to This here is the relevant portion of my github actions setup
|
removing |
I figured that this issue persisted even when the name is |
FWIW -- about a month ago pipenv changed to be more strict on if Interestingly though, we ran into this issue today as well at work and found we also had |
It would appear the pipenv cache implementation assumes it will be at this location, making |
At the risk of sounding very obvious, but maybe this'll help someone in any case: We ran into this issue recently. (For example; see here.) What 'fixed' it for us was the realization that whenever this issue occurred, the workflow as a whole needed to skip all the steps that actually required python and/or pip -- and then to disable the setup-python step as well whenever that was the case. (That might also be going on with the reproduction of others' but in a more subtle way: All of the actions taken that I can see here are for packages that are likely to be included and at latest version anyway, so the cache might never get written to. Again, sorry if that was already obvious.) In any case, however inelegant it may be, setting up something, not using it, and then cleaning it up again should probably (also) not result in an error. (Just putting that out there, since that is a slightly different case than what OP is talking about, which may or may not require a different approach to solve.) |
Why these changes are being introduced: There is a known bug in `actions/setup-python` related to caching: actions/setup-python#436 that we experienced with the first auto-deploy runs for the alma-creditcardslips application. As a quick fix, we simply remove the cache option for pipenv from the step and everything runs smoothly. How this addresses that need: * Remove `cache: 'pipenv'` from the actions/setup-python for both the dev and stage ecr-shared-deploy- workflows. Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IN-735
- there is a [bug](actions/setup-python#436) in the setup-python action
- there is a [bug](actions/setup-python#436) in the setup-python action
I'm seeing the same error in FastAPI, with In the initial stage of the run I get:
And then in the Post Setup I get:
|
Same story for me with pip cache. For some reason it works in one repo and fails in another with no useful info even in debug log. Maybe it's time to update cache module?
|
I have the same error with a pipenv cache setting. I have a .venv directory under my checkout root directory, so pipenv creates the virtual environment inside the project workspace(as opposed to a location in the home directory). Looks like the cache logic doesn't honor the project-local location though. |
@smougenot, I guess in your case it's better to call |
… exist on disk: /home/runner/.local/share/virtualenvs" error for lint workfow. Don't install the virtual environment in the project directory. From actions/setup-python#436, it seems the caching implementation of `setup-python` when using `pipenv` expects the virtual environment to be at the default location and isn't properly accounting for the `PIPENV_VENV_IN_PROJECT` environment variable.
There seems some issue of pipenv caching, see <actions/setup-python#436>
There seems some issue of pipenv caching, see <actions/setup-python#436>
There seems some issue of pipenv caching, see <actions/setup-python#436>
There seems some issue of pipenv caching, see <actions/setup-python#436>
The cleanup step seemingly fails if the cache is never used. This is wrong (cache non-use should never be a failure), but is seemingly unfixed upstream. See: actions/setup-python#436 Signed-off-by: William Woodruff <[email protected]>
I've experienced another variant of this: if you add Example failing run: https://github.com/C2SP/x509-limbo/actions/runs/9739572591/job/26897420759 Exact reproduction steps:
The failure in (4) seems unambiguously incorrect to me: a caching layer should never fail on an empty cache if no cache was loaded to begin with. |
* build(deps): update ruff requirement from <0.4.10 to <0.5.1 Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@v0.0.18...0.5.0) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * ci: remove Python from check-harnesses The cleanup step seemingly fails if the cache is never used. This is wrong (cache non-use should never be a failure), but is seemingly unfixed upstream. See: actions/setup-python#436 Signed-off-by: William Woodruff <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: William Woodruff <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: William Woodruff <[email protected]>
* fix: Correct typo in use of ARM reinterpret u32 -> f32 The type order is swapped; we got it right most places but missed it here. Not sure why CI didn't catch this error? * chore: Add Ubuntu 24 to CI * chore: Simplify matrix for build CI * chore: Update nanobind pin * chore: Hopefully fix CI with latest Python by using a proper env * fix: Specify modern Python and remove unnecessary pip install Eventually, we're going to want to add Python tests, so we might as well set up for it. Also, nanobind only requires `typing_extensions` on Python <3.11, so we can remove that install (which errors on Ubuntu 24 with Python 3.12). * I love devops so much actions/setup-python#436 (comment)
Hello Everyone, Thank you once again for creating this issue and The error related to pipenv or poetry package managers cannot be changed to a warning due to the necessity of having the Pipfile.lock or poetry.lock file for caching in the actions/Setup-python. To resolve this issue, please consider one of the following options: Add the Pipfile.lock / poetry.lock file: Ensure that the Pipfile.lock file or poetry.lock is present in your repository. You can generate this file by running pipenv lock. |
Hello @mrlubos, Please let us know if you have any further concerns on the above information. |
I want to push back slightly on this: caching should always be referentially transparent, meaning that the cache step itself should never fail, even if the caching operation fails or can't be completed (e.g. if there's nothing to cache). With that being said, I can understand that this would require multiple changes to fix. As a stop-gap, my suggestion would be to improve the error messaging here: if the caching step fails because there's nothing to cache, the error message could say that explicitly and suggest that the maintainer remove the step entirely, rather than returning the current (confusing) message. |
It would be nice to fail gracefully here. Sometimes an action will install deps, sometimes it won't - right now this bug means you have to completely forgo caching via For example, imagine a task that first checks the time so that it only ever runs once a day, or some such thing. |
Hello Everyone, The PR #968 has been merged to update the error message when no dependencies are found to cache, improving its clarity. Please validate the changes by using the actions/setup-python@main branch and confirm to proceed to close this issue. |
That error message looks better, thank you! However, I'd like to reiterate that I think this shouldn't be an error at all, per caching semantics. As such I think this should remain open until the post-step actually ceases to fail. |
Hello @woodruffw , Thank you for the confirmation. Throwing an error message at this point in the post-setup phase is crucial for handling intermittent failures during package installations. Dependencies can sometimes fail to install due to issues such as network instability, timeouts, or conflicts. By raising an error at this stage, we can explicitly identify and address these failures, rather than letting the workflow proceed with an incomplete or inconsistent environment. Adding a clear error message when package installation fails or when there are no dependencies to cache will significantly improve the reliability and predictability of the setup process. Please feel free to reach us if any concerns/clarifications needed. |
Description:
A clear and concise description of what the bug is.
Hey! So this used to work just a few days ago. We’ve been having some issues with cache in the last few days (see here for details), this is a brand new issue which I think might or might not be related to the previous problem. Simply put, the action fails in the post step with the following message.
Here’s the actual step:
Action version:
Specify the action version
3.1.2
Platform:
Runner type:
Tools version:
3.9.13
Repro steps:
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.
Expected behavior:
A description of what you expected to happen.
No issue occurs, the same way it used to work a week ago.
Actual behavior:
A description of what is actually happening.
This error message appears on every run.
The text was updated successfully, but these errors were encountered: