Skip to content

setup-python does not setup the default python version as specified #425

Description

@shelper

Description:
i have the following setup in my ci.yml

env:
  PYTHON_VERSION: 3.8
  POETRY_VERSION: 1.2.0a2
...
Jobs:
  ci:
     steps:
      - name: Setup Python with poetry caching
        id: setup-python
        uses: actions/setup-python@v3
        with:
          python-version: ${{env.PYTHON_VERSION}}
          cache: 'poetry'
      - name: run poetry shell
         run: poetry shell

I saw that python 3.8 is successfully setted up.

Run actions/setup-python@v3
  with:
    python-version: 3.8
    cache: poetry
    token: ***
  env:
    PYTHON_VERSION: 3.8
    POETRY_VERSION: 1.2.0a2
Successfully setup CPython (3.8.10)
"C:\Program Files (x86)\pipx_bin\poetry.exe" config --list
cache-dir = "C:\\Users\\runneradmin\\AppData\\Local\\pypoetry\\Cache"
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "***cache-dir***\\virtualenvs"  # C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs
poetry cache is not found

but why the next step of run poetry shell still says active python version of 3.7?

Run poetry shell
poetry shell
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '**_0_**'"
env:
PYTHON_VERSION: 3.8
POETRY_VERSION: 1.2.0a2
pythonLocation: C:\hostedtoolcache\windows\Python\3.8.10\x64
**The currently activated Python version 3.7.9 is not supported by the project (^3.8.0).**
Trying to find and use a compatible version.
Using python3 (3.8.10)
Creating virtualenv zetta-lstthbR--py3.8 in C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs
Spawning shell within C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\zetta-lstthbR--py3.8
PowerShell 7.2.4
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.

Action version:
Specify the action version
tried both v3 and v4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Activity

  1. Kurt-von-Laven commented on Jun 10, 2022

    @Kurt-von-Laven
    Contributor

    This seems like a duplicate of #374. I am not a maintainer of the setup-python action, but I suggest taking a look at #374 (comment) for a work around until the root cause is fixed.

  2. shelper commented on Jun 10, 2022

    @shelper
    Author

    thanks @Kurt-von-Laven but on windows i cannot use something like poetry env use 3.8... i have to write something to find the location of python on windows and pass the full path to poetry env use path. i will close this anyway, and post acomment in #374

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions