setup-python: Poetry caching fails because Poetry is not installed
Description: Poetry caching fails because Poetry is not installed.
Action version: v3
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version: All Python versions.
Repro steps:
Run a workflow with the setup-python
action using the cache: 'poetry'
argument. I have set up a minimal reproduction in a public repository. There is an example of a failed workflow run in that project.
Expected behavior: I would expect Poetry dependencies to be restored if they exist.
Actual behavior:
The step fails due to a missing poetry
executable.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 17 (3 by maintainers)
Commits related to this issue
- Revert "Use actions/setup-python v3" See https://github.com/actions/setup-python/issues/369 This reverts commit 6f4366de8e0e84824d62a1ec22564e073d6ab71f. — committed to srittau/rouver by srittau 2 years ago
- ci(workflows): :bug: remove Poetry caching Need poetry install before, but it would not use the correct Python version See https://github.com/actions/setup-python/issues/369 — committed to MickaelFontes/dangling-finder by MickaelFontes 4 months ago
Doesn’t work for me as of today @4.2.0
This should be reopened. The docs also still indicate that poetry must be installed before using this action: https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
I think it goes without saying, but until this gets resolved, python being a prerequisite of poetry renders the use of this action pretty much pointless
The reason I’m not filing a separate is I think it’d be closed on the same grounds as this issue.
But I’d like to note my workaround for python versions and poetry 1.x to work:
It looks like installing
poetry
beforeactions/setup-python
causespoetry
to use the earlier python version. e.g. if GH uses python 3.8 by default and poetry is installed in that, your poetry is going to run in 3.8, no matter whatactions/setup-python
is.It looks like
poetry install
doesn’t obey the python version that actions/setup-python uses.Here’s an example
https://github.com/vcs-python/libvcs/runs/5801763507?check_suite_focus=true
https://github.com/vcs-python/libvcs/blob/f2798b8d4e5199a88d16118f2ade74b328e860f6/.github/workflows/tests.yml
It also happens when installing via
pipx install poetry
My workaround is to use a matrix and
poetry env <version>
You can replace "Install poetry
with
pipx install poetry, or
pipx install poetry==1.1.12`, etc.This isn’t fixed…the error still occurs as of today
Hello everyone. For now I’m going to close the issue because we released a new version with fix and updated major tag.
I don’t know about other people’s use cases, but consider this scenario:
python3 -m venv .venv
).venv/bin/pip install poetry
).venv/bin/poetry install
)In this scenario, using the cache option will fail because poetry doesn’t exist, but why does poetry need to exist before the cache is even accessed? It hasn’t installed any packages yet