Skip to content
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

Python 3.12 is not symlinked to Python on macOS 12.6.7 (macos-latest) #701

Closed
2 of 5 tasks
lithomas1 opened this issue Jul 14, 2023 · 3 comments
Closed
2 of 5 tasks
Labels
bug Something isn't working

Comments

@lithomas1
Copy link

Description:
A clear and concise description of what the bug is.

Python 3.12 is not symlinked to python on macOS 12.6.7 (macos-latest).
Instead, python points to the Python 2.7 that comes with macOS

Action version:
actions/setup-python@v4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

Python 3.12-dev (3.12.0-beta4)

Repro steps:

See this workflow

https://github.com/pandas-dev/pandas/actions/runs/5555915106/jobs/10147721442?pr=53743

Expected behavior:

python should point to Python 3.12

Actual behavior:
python points to the Python 2.7 that comes with macOS

@lithomas1 lithomas1 added bug Something isn't working needs triage labels Jul 14, 2023
@deric4
Copy link

deric4 commented Jul 15, 2023

This caught my eye because of #684 and got nerd sniped 🤓

I think this is happening because the of the following setting in the workflow definition
https://github.com/pandas-dev/pandas/actions/runs/5555915106/workflow?pr=53743#L19-L21

defaults:
  run:
    shell: bash -el {0}

Each step is getting its own login shell which doesn't seem to respect the changes made from actions/setup-python

Its not clear to me as to why it works for 3.11 but not 3.12. since the environment seems to get setup the same way across the login/non-login shells.

purely speculation but perhaps there's an issue with how versions not installed in hostedtoolcache are setup that differs here.

I updated my runner reference workflow for python to try and debug why this is happening.
https://github.com/deric4/github-action-runner-reference/actions/runs/5560351139

Some of the info is split up among the summary values for each job and the actual log output. Sorry bout that 😅

If there's no other reason for needing the login shell then it might be easier just to change that since this seems like another https://xkcd.com/1987 lol.

Path in a step with login shell after setup-python

# path when default shell is set to `bash -el {0}`
# formatted for readability. each segment on newline
PATH=/usr/local/lib/ruby/gems/3.0.0/bin:
/usr/local/opt/[email protected]/bin:
/usr/local/opt/pipx_bin:
/Users/runner/.cargo/bin:
/usr/local/opt/curl/bin:
/usr/local/bin:
/usr/local/sbin:
/Users/runner/bin:
/Users/runner/.yarn/bin:
/Users/runner/Library/Android/sdk/tools:
/Users/runner/Library/Android/sdk/platform-tools:
/Library/Frameworks/Python.framework/Versions/Current/bin:
/Library/Frameworks/Mono.framework/Versions/Current/Commands:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/Library/Apple/usr/bin:
/Library/Frameworks/Mono.framework/Versions/Current/Commands:
/Users/runner/hostedtoolcache/Python/3.12.0-beta.4/x64/bin:
/Users/runner/hostedtoolcache/Python/3.12.0-beta.4/x64:
/usr/local/lib/ruby/gems/3.0.0/bin:
/usr/local/opt/[email protected]/bin:
/usr/local/opt/pipx_bin:
/Users/runner/.cargo/bin:
/usr/local/opt/curl/bin:
/usr/local/sbin:
/Users/runner/bin:
/Users/runner/.yarn/bin:
/Users/runner/Library/Android/sdk/tools:
/Users/runner/Library/Android/sdk/platform-tools:
/Library/Frameworks/Python.framework/Versions/Current/bin:
/Users/runner/.dotnet/tools:
/Users/runner/.ghcup/bin:
/Users/runner/hostedtoolcache/stack/2.11.1/x64:
/Users/runner/.dotnet/tools:
/Users/runner/.ghcup/bin:
/Users/runner/hostedtoolcache/stack/2.11.1/x64

Path in a step without login shell after setup-python

# path when default shell is set to `bash`
PATH=/Users/runner/hostedtoolcache/Python/3.12.0-beta.4/x64/bin:
/Users/runner/hostedtoolcache/Python/3.12.0-beta.4/x64:
/usr/local/lib/ruby/gems/3.0.0/bin:
/usr/local/opt/[email protected]/bin:
/usr/local/opt/pipx_bin:
/Users/runner/.cargo/bin:
/usr/local/opt/curl/bin:
/usr/local/bin:
/usr/local/sbin:
/Users/runner/bin:
/Users/runner/.yarn/bin:
/Users/runner/Library/Android/sdk/tools:
/Users/runner/Library/Android/sdk/platform-tools:
/Library/Frameworks/Python.framework/Versions/Current/bin:
/Library/Frameworks/Mono.framework/Versions/Current/Commands:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/Users/runner/.dotnet/tools:
/Users/runner/.ghcup/bin:
/Users/runner/hostedtoolcache/stack/2.11.1/x64
3_12_login_vs_not

but why does it work on 3.11?

curiously seems to work but suffers the same problem?

image

with login shell macos12 setup-python 3.11

$ type -a python
python is /usr/local/bin/python
python is /Library/Frameworks/Python.framework/Versions/Current/bin/python
python is /usr/local/bin/python
python is /Users/runner/hostedtoolcache/Python/3.11.4/x64/bin/python
python is /Users/runner/hostedtoolcache/Python/3.11.4/x64/python
python is /Library/Frameworks/Python.framework/Versions/Current/bin/python

without login shell macos12 setup-python 3.11

$ type -a python
python is /Users/runner/hostedtoolcache/Python/3.11.4/x64/bin/python
python is /Users/runner/hostedtoolcache/Python/3.11.4/x64/python
python is /usr/local/bin/python
python is /Library/Frameworks/Python.framework/Versions/Current/bin/python

with login shell macos12 setup-python 3.12

$ type -a python
python is /usr/local/bin/python
python is /Library/Frameworks/Python.framework/Versions/Current/bin/python
python is /usr/local/bin/python
python is /Users/runner/hostedtoolcache/Python/3.12.0-beta.4/x64/bin/python
python is /Users/runner/hostedtoolcache/Python/3.12.0-beta.4/x64/python
python is /Library/Frameworks/Python.framework/Versions/Current/bin/python

without login shell macos12 setup-python 3.12

type -a python
python is /Users/runner/hostedtoolcache/Python/3.12.0-beta.4/x64/bin/python
python is /Users/runner/hostedtoolcache/Python/3.12.0-beta.4/x64/python
python is /usr/local/bin/python
python is /Library/Frameworks/Python.framework/Versions/Current/bin/python

@dmitry-shibanov
Copy link
Contributor

Hello @lithomas1. Thank you for your report. We'll take a look at this issue.

@dmitry-shibanov
Copy link
Contributor

Hello everyone. Sorry for the late response. It looks like an expected behaviour because shell: bash -el {0} appends default tools at the beginning of the PATH that is why python from /usr/local/bin is used. You can try to use different shell set up or reach the proper python version through python-path output.

For now I'm going to close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants