setup-python icon indicating copy to clipboard operation
setup-python copied to clipboard

macOS 13 image doesn't have Python pre-installed in the hostedtoolcache

Open remyjette opened this issue 2 years ago • 4 comments

Description

Thanks for getting macOS-13 up and running! I just gave it a quick spin on my project.

Every single one of our jobs starts with

- task: UsePythonVersion@0

to ensure that that the latest release of Python is the one first in the PATH, to avoid using a potentially-very-outdated Python, especially on platforms like macOS.

On the new macOS-13 image, this doesn't appear to be pre-installed anymore and our builds show the following warning:

##[warning]You should provide GitHub token if you want to download a python release. Otherwise you may hit the GitHub anonymous download limit. Downloading: https://github.com/actions/python-versions/releases/download/3.11.3-4626642838/python-3.11.3-darwin-x64.tar.gz

If I try to set disableDownloadFromRegistry: true then this becomes an error:

##[error]Version spec 3.x for architecture x64 did not match any version in Agent.ToolsDirectory. Versions in /Users/runner/hostedtoolcache:

If this is a Microsoft-hosted agent, check that this image supports side-by-side versions of Python at https://aka.ms/hosted-agent-software. If this is a self-hosted agent, see how to configure side-by-side Python versions at https://go.microsoft.com/fwlink/?linkid=871498.

Platforms affected

  • [X] Azure DevOps
  • [ ] GitHub Actions - Standard Runners
  • [ ] GitHub Actions - Larger Runners

Runner images affected

  • [ ] Ubuntu 20.04
  • [ ] Ubuntu 22.04
  • [ ] macOS 11
  • [ ] macOS 12
  • [ ] Windows Server 2019
  • [ ] Windows Server 2022

Image version and build link

20230419.1

Is it regression?

Yes

Expected behavior

Python is pre-installed, and the UsePythonVersion@0 finds it in the cache and prepends it to the PATH:

Found tool in cache: Python 3.11.3 x64 Prepending PATH environment variable with directory: /Users/runner/hostedtoolcache/Python/3.11.3/x64 Prepending PATH environment variable with directory: /Users/runner/hostedtoolcache/Python/3.11.3/x64/bin

Actual behavior

Python has to be downloaded from the registry, potentially hitting an anonymous download limit:

##[warning]You should provide GitHub token if you want to download a python release. Otherwise you may hit the GitHub anonymous download limit. Downloading: https://github.com/actions/python-versions/releases/download/3.11.3-4626642838/python-3.11.3-darwin-x64.tar.gz

Repro steps

Add a UsePythonVersion@0 task to a pipeline using the macOS-13 agent and run the pipeline.

remyjette avatar Apr 24 '23 18:04 remyjette

~~I wonder why GITHUB_TOKEN is not used to bypass anonymous download limit ))~~

it's ADO

ilia-shipitsin avatar Apr 24 '23 19:04 ilia-shipitsin

well....

image

ilia-shipitsin avatar Apr 24 '23 19:04 ilia-shipitsin

@marko-zivic-93 @dmitry-shibanov transferring to you as it is actions/python-versions connected. As macOS-13 runner is now available in GitHub could you start repacking python for macOS-13 too?

mikhailkoliada avatar Apr 24 '23 20:04 mikhailkoliada

@mikhailkoliada I don't think we need Python to be re-packaged for macOS-13, https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json only has a single package for all x64 macOS versions, for example:

{
"filename": "python-3.11.3-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/python-versions/releases/download/3.11.3-4626642838/python-3.11.3-darwin-x64.tar.gz"
},

There are not separate download URLs for the existing macOS-11 or macOS-12 images.

I believe the issue is that in the macOS-13 image, the hostedtoolcache has not been populated. For example, https://github.com/actions/runner-images/blob/main/images/macos/toolsets/toolset-13.json has no toolcache entry, compared to https://github.com/actions/runner-images/blob/main/images/macos/toolsets/toolset-12.json which does.

remyjette avatar Apr 25 '23 04:04 remyjette