v3.1's default poetry example uses wrong python version
See original GitHub issueDescription:
The default configuration example for #281’s new example installs poetry before actions/setup-python is ran.
This can run into some funky issues in poetry itself since poetry may stick to use the python version it was installed in.
This may be on the poetry side. I’m not sure:
- Oldest post I could find (closed): https://github.com/python-poetry/poetry/issues/655
- https://github.com/python-poetry/poetry/issues/4101
- ~~See if in 1.2.x prerelease PR helps: https://github.com/python-poetry/poetry/pull/4852~~: Seems not to https://github.com/tony/setup-python-poetry-version-example/blob/main/.github/workflows/experiment-with-poetry-prerelease.yml
Action version: v3.1
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
Repro steps:
Reproduction repo: https://github.com/tony/setup-python-poetry-version-example
-
https://github.com/tony/setup-python-poetry-version-example/tree/main/.github/workflows
- default-example.yml
- default-example-install-poetry.yml
- experiment-with-poetry-prerelease.yml
- workaround.yml by trigger
poetry env use <version>to force version
Runs: https://github.com/tony/setup-python-poetry-version-example/actions
Expected behavior:
poetry should respect the version in actions/setup-python
Actual behavior:
It uses the python version poetry was installed with before actions/setup-python was ran.
Issue Analytics
- State:
- Created a year ago
- Reactions:16
- Comments:18 (6 by maintainers)

Top Related StackOverflow Question
You can get around this problem by telling
poetryto use the same version of python as installed bysetup-pythonwith thepoetry env usecommandThis has been working for me:
First I ran this, to get a list of the caches, in this case, there was only one.
Then I ran this, to delete the cache, based off of the cache ID in the previous command.
More information available here: https://docs.github.com/en/rest/actions/cache