Skip to content

pythonLocation no longer being set in v4 #537

Closed

Description

@shadycuz

Description:
When upgrading from setup-python@v3 to setup-python@v4, other jobs fail because env.pythonLocation is no longer being set.

Action version:
v4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
all?

Repro steps:
Here is the PR. Here is the failed build.

Expected behavior:
python location to be available.

Actual behavior:
It appears to be empty.

Here is the code that now fails with v4.

- name: Set up Python
   uses: actions/setup-python@v4

- name: Python Cache
   uses: actions/cache@v3
     with:
       path: ${{ env.pythonLocation }}
       key: ${{ env.pythonLocation }}-${{ hashFiles('tests/requirements.txt') }}

Activity

  1. MaksimZhukov commented on Nov 8, 2022

    @MaksimZhukov
    Contributor

    Hello @shadycuz! Thank you for reporting this!
    We will investigate the issue and let you know as soon as we have updates.

  2. dsame commented on Nov 18, 2022

    @dsame
    Contributor

    Hello @shadycuz
    The problem appears because the step Set up Python does not have python version from the hosted toolcache.

    You should point out some:

          - name: Set up Python
            uses: actions/setup-python@v4
            with:
              python-version: '3.9'
    

    This build (with python-version:) shows the the pipeline fixed: https://github.com/akv-demo/setup-python-test/actions/runs/3495220045/jobs/5851739586#step:5:14

    And this build (without python-version:) repros the issues: https://github.com/akv-demo/setup-python-test/actions/runs/3495204909/jobs/5851706555#step:5:16

    Please confirm the answer solves the issue.

  3. shadycuz commented on Nov 18, 2022

    @shadycuz
    Author

    @dsame But I used to not have to manually specify python-version: '3.9' to get it to work. Was that a breaking change from v3 to v4.

    Edit: your own experiment seems to show that it worked in v3 but doesn't in v4.

  4. dmitry-shibanov commented on Nov 21, 2022

    @dmitry-shibanov
    Contributor

    Hello @shadycuz. It is an expected behaviour because in v3 tag the action had default value for python-version input. It was removed in scope of this pull request.

  5. shadycuz commented on Nov 21, 2022

    @shadycuz
    Author

    Alright alright, I read throught the 4.0 release notes again and it does seem to call out that the default is going away. I think it could be clearer. Same with the error msg. If a user did not specify python-version and you don't find a python file. Then perhaps you could tell them they need one or the other.

    I don't really like this change, but I guess its time I use the python version file.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions