-
Notifications
You must be signed in to change notification settings - Fork 566
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
v3.1's default poetry example uses wrong python version #374
Comments
How hard would it be to defer caching to a later step? Then you wouldn't have to rely on the system version of Python. I'm thinking something like this: - name: Install Python
uses: actions/setup-python@v3
with: # Install Python, skip caching
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: python -m pip install poetry
- name: Cache Poetry deps
uses: actions/setup-python@v3
with: # Restore cache, skip Python installation
cache: poetry |
@matthew-mcallister @tony this action relies on poetry to tell it's config values. The problem with locking poetry onto 1 version can be solved by installing poetry with curl. This action wil help you https://github.com/snok/install-poetry. However, take note, that it's significantly slower than |
You can get around this problem by telling 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 |
@falkben Your recipe works for me if I disable caching. Otherwise, it still uses the wrong Python. I introduced caching in the latest PR. I'm thinking I might need to delete the cache for some reason. |
Well, I can't find a way to delete the cache, so I've disabled it for now, and the correct Python is used again on |
@dogweather, for me it seems like poetry's ignoring your |
see actions/setup-python#374 (comment) windows hosts cannot find python3.x in $PATH, but after setup-python the python executable uses the correct version
* Run tests in python 3.10 * Set python version as string if someone tries to update to 3.10, it will fail and try to install pyhton 3.1 because integer * Rename run-tests workflow to run_tests (consistency) * Bump workflow actions, refactor python setup and cache Based on https://github.com/actions/setup-python#caching-packages-dependencies * Disable fast-fail * Make poetry use the correct python version see actions/setup-python#374 (comment) windows hosts cannot find python3.x in $PATH, but after setup-python the python executable uses the correct version * Bump poetry deps some builds are complainig about the lock file Make it compatible with python 3.10 poetry update in python 3.10, macOS M1
same for windows, see #425 |
Unfortunately, poetry is still broken with v4. |
Hello, everyone 👋 It's a well-known issue of the poetry. Poetry tends to use the system's version of the python. Workarounds from the comments above can be helpful. |
Somehow poetry will try to resolve the correct version after install, if project has a specific version 2022-07-02T22:52:39.4923852Z ##[group]Run poetry install
2022-07-02T22:52:39.4924106Z �[36;1mpoetry install�[0m
2022-07-02T22:52:39.4978618Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-07-02T22:52:39.4978872Z env:
2022-07-02T22:52:39.4979142Z pythonLocation: /opt/hostedtoolcache/Python/3.10.5/x64
2022-07-02T22:52:39.4979489Z LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.5/x64/lib
2022-07-02T22:52:39.4979743Z ##[endgroup]
2022-07-02T22:52:39.8768892Z The currently activated Python version 3.8.10 is not supported by the project (^3.9).
2022-07-02T22:52:39.8769599Z Trying to find and use a compatible version.
2022-07-02T22:52:39.9175522Z Using python3 (3.10.5) |
Hi, @psychobolt 👋 ! Thanks for the comment. but in that case, poetry just writes that it uses python 3.10.5, in fact, it proceeds to use 3.8.10 and because of that, your workflow can be failed later. |
Using the workaround posted here: actions/setup-python#374 (comment)
Using the workaround posted here: actions/setup-python#374 (comment)
Using the workaround posted here: actions/setup-python#374 (comment)
Using the workaround posted here: actions/setup-python#374 (comment) Former-commit-id: 184c35e Former-commit-id: abea5f5cf51c765f090077e953d202ba9b875fe3
Using the workaround posted here: actions/setup-python#374 (comment) Former-commit-id: ddf90f7 Former-commit-id: 5ea8accbda113ec7612db6c8443a1876304e32d2
Using the workaround posted here: actions/setup-python#374 (comment) Former-commit-id: 184c35e Former-commit-id: abea5f5cf51c765f090077e953d202ba9b875fe3 Former-commit-id: 5efaaef
Hello everyone. Sorry for the late response. We released a new version of the action and updated the major tag with possible fix. Could you please confirm that everything works as expected. |
I can confirm the latest version (4.2.0) fixes the problem in the places I've previously had to add the |
Hello @Tenzer. Thank you for your response. For now I'm going to close the issue. |
This was originally added in #316 but retracted due to actions/setup-python#374. In recent versions this python version issue has apparently been fixed.
⚠️ Dependabot is rebasing this PR⚠️ Rebasing might not happen immediately, so don't worry if this takes some time. Note: if you make any changes to this PR yourself, they will take precedence over the rebase. Bumps github/codeql-action from 2.1.18 to 2.1.19. Changelog Sourced from github/codeql-action's changelog. CodeQL Action Changelog [UNRELEASED] No user facing changes. 2.1.19 - 17 Aug 2022 Add the ability to filter queries from a code scanning run by using the query-filters option in the code scanning configuration file. #1098 In debug mode, debug artifacts are now uploaded even if a step in the Actions workflow fails. #1159 Update default CodeQL bundle version to 2.10.3. #1178 The combination of python2 and Pipenv is no longer supported. #1181 2.1.18 - 03 Aug 2022 Update default CodeQL bundle version to 2.10.2. #1156 2.1.17 - 28 Jul 2022 Update default CodeQL bundle version to 2.10.1. #1143 2.1.16 - 13 Jul 2022 You can now quickly debug a job that uses the CodeQL Action by re-running the job from the GitHub UI and selecting the "Enable debug logging" option. #1132 You can now see diagnostic messages produced by the analysis in the logs of the analyze Action by enabling debug mode. To enable debug mode, pass debug: true to the init Action, or enable step debug logging. This feature is available for CodeQL CLI version 2.10.0 and later. #1133 2.1.15 - 28 Jun 2022 CodeQL query packs listed in the packs configuration field will be skipped if their target language is not being analyzed in the current Actions job. Previously, this would throw an error. #1116 The combination of python2 and poetry is no longer supported. See actions/setup-python#374 for more details. #1124 Update default CodeQL bundle version to 2.10.0. #1123 2.1.14 - 22 Jun 2022 No user facing changes. 2.1.13 - 21 Jun 2022 Update default CodeQL bundle version to 2.9.4. #1100 2.1.12 - 01 Jun 2022 Update default CodeQL bundle version to 2.9.3. #1084 2.1.11 - 17 May 2022 Update default CodeQL bundle version to 2.9.2. #1074 2.1.10 - 10 May 2022 ... (truncated) Commits f5d217b Merge pull request #1192 from github/update-v2.1.19-5502fefd 7c3d74c Move changelog note to right release 04ea3b1 Update changelog for v2.1.19 5502fef Merge pull request #1191 from github/edoardo/fix-upload-times 0349bb0 Fix TRAP cache upload timing 3154c4f Merge pull request #1190 from github/henrymercer/fix-debug-artifact-tests-on-... b21cab9 Mock expect-error input to avoid errors in Action integration tests 219a937 Require test mode to be set to use expect-error input ff9d53b Dump GitHub event in debug artifacts failure workflow 5f4cfb0 Merge pull request #1188 from github/edoardo/round-fields Additional commits viewable in compare view Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase. Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: @dependabot rebase will rebase this PR @dependabot recreate will recreate this PR, overwriting any edits that have been made to it @dependabot merge will merge this PR after your CI passes on it @dependabot squash and merge will squash and merge this PR after your CI passes on it @dependabot cancel merge will cancel a previously requested merge and block automerging @dependabot reopen will reopen this PR if it is closed @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
I encountered this issue as well, and spent some time trying to figure out why this was still happening after upgrading the action to v4.2.0. To solve it, I used the GitHub API to get a list of caches, and then delete it. Once done, I re-ran the workflow, and it rebuilt the cache and had the correct python version. |
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 |
Each step runs in its own process in GitHub Actions so environment changes are not preserved between steps. I may need to add this to the `poetry run ...` commands as well. I hope it's unnecessary. Apparently Poetry has some "well-known" issues with correctly detecting the desired Python version. See: * Poetry issue: python-poetry/poetry#655 * setup-python workaround: actions/setup-python#374 (comment)
It sounds like Poetry will grab the Python env from the cache. The cached python is incorrect so hopefully this will result in the correct Python version. See: actions/setup-python#374 (comment)
Currently the poetry cache for the GitHub Actions appears not to be being used. See: actions/setup-python#374
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:
See if in 1.2.x prerelease PR helps: Add (experimental) option to use current active python to create venv ("pyenv way") python-poetry/poetry#4852: Seems not to https://github.com/tony/setup-python-poetry-version-example/blob/main/.github/workflows/experiment-with-poetry-prerelease.ymlAction version:
v3.1
Platform:
Runner type:
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
poetry env use <version>
to force versionRuns: https://github.com/tony/setup-python-poetry-version-example/actions
Expected behavior:
poetry
should respect the version inactions/setup-python
Actual behavior:
It uses the python version
poetry
was installed with beforeactions/setup-python
was ran.The text was updated successfully, but these errors were encountered: