question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v3.1's default poetry example uses wrong python version

See original GitHub issue

Description:

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:

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

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:closed
  • Created a year ago
  • Reactions:16
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

21reactions
falkbencommented, Apr 5, 2022

You can get around this problem by telling poetry to use the same version of python as installed by setup-python with the poetry env use command

This has been working for me:

- uses: actions/checkout@v3

- name: Install poetry
  run: pipx install poetry

- name: Setup Python
  uses: actions/setup-python@v3
  with:
    python-version: "3.10"
    cache: "poetry"

- name: Install dependencies
  run: |
    poetry env use "3.10"
    poetry install --no-interaction
5reactions
omBrattengcommented, Aug 31, 2022

To solve it, I used the GitHub API to get a list of caches, and then delete it.

How did you delete it? Where did you delete it from?

First I ran this, to get a list of the caches, in this case, there was only one.

gh api \
 -H "Accept: application/vnd.github+json" \
 /repos/OWNER/REPO/actions/caches

Then I ran this, to delete the cache, based off of the cache ID in the previous command.


gh api \
  --method DELETE \
  -H "Accept: application/vnd.github+json" \
  /repos/OWNER/REPO/actions/caches/CACHE_ID

More information available here: https://docs.github.com/en/rest/actions/cache

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry doesn't use the correct version of Python - Stack Overflow
It seems that Poetry defaults back to the system version of Python. How do I change this so that it uses the version...
Read more >
Configure a Python interpreter | PyCharm Documentation
When PyCharm stops supporting any of the outdated Python versions, the corresponding Python interpreter is marked as unsupported. When you ...
Read more >
Working with the AWS CDK in Python
Python is a fully-supported client language for the AWS CDK and is considered stable. Working with the AWS CDK in Python uses familiar...
Read more >
History | Poetry - Python dependency management and ...
Fix an issue where Git dependencies failed to clone when insteadOf was used in .gitconfig using the Dulwich Git client (#6506). Fix an...
Read more >
Using Python environments in VS Code
venv, Allows you to manage separate package installations for different projects and is installed with Python 3 by default (install python3-venv if you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found