actions / setup-python

Set up your GitHub Actions workflow with a specific version of Python
MIT License
1.66k stars 532 forks source link

macOS package installation fails for non-privileged user #925

Open AttilaT opened 4 weeks ago

AttilaT commented 4 weeks ago

Description: Can not install python with a non-privileged user, even if the user is part of admin group and has sudo permission to use /usr/sbin/installer

The error is:

Installed versions
  Version 3.11 was not found in the local cache
  Version 3.11 is available for downloading
  Download from "https://github.com/actions/python-versions/releases/download/3.11.9-9947079978/python-3.11.9-darwin-arm64.tar.gz"
  Extract downloaded archive
  /usr/bin/tar xz -v -C /Users/runner/action-runner-MZNpiIYqzp/actions-runner/_work/_temp/85d1ca15-2e48-4d05-a16e-22d4e9f241dc -f /Users/runner/action-runner-MZNpiIYqzp/actions-runner/_work/_temp/02f8[39](https://private-github.com/test-repo/actions/runs/35567/job/3456709#step:3:40)a4-27b4-4adc-8b70-ba50514egba9
  x ./
  x ./setup.sh
  x ./python-3.11.9-macos11.pkg
  x ./build_output.txt
  Execute installation script
  Check if Python hostedtoolcache folder exist...
  Creating Python hostedtoolcache folder...
  Install Python binaries from prebuilt package
  installer: Package name is Python
  installer: Installing at base path /
  installer: The install was successful.
  Create hostedtoolcach symlinks (Required for the backward compatibility)
  Create Python 3.11.9 folder
  Create additional symlinks (Required for the UsePythonVersion Azure Pipelines task and the setup-python GitHub Action)
  Error: ln: python311: Permission denied
  Error: The process '/bin/bash' failed with exit code 1

The error occurs due to the fact that /Library/Frameworks/Python.framework/ is owned by root:admin and the setup.sh is creating simbolic links to bin folder in /Library/Frameworks/Python.framework/<versions>/bin which it doesn't have permissions.

Action version: Same error on v5, v4, v3

Platform:

Runner type:

Tools version: Tested on python v3.11

Repro steps:
Simply run the installation as a non-privileged user

Expected behavior: Ideally, the installation is performed directly into the cash folder instead of system wide.

Actual behavior: Installation fails

priyagupta108 commented 4 weeks ago

Hi @AttilaT 👋, Thank you for your report. We'll investigate the issue and get back to you.