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

Forced to use /Users/runner for hostedtoolscache; need a way to override

Open NorseGaud opened this issue 1 year ago • 8 comments

https://github.com/actions/setup-python/blob/0b93645e9fea7318ecaed2b359559ac225c90a2b/src/setup-python.ts#L81

Requesting that there be a way to override /Users/runner to avoid"

Run actions/setup-python@v5
Installed versions
  Version 3.9 was not found in the local cache
  Version 3.9 is available for downloading
  Download from "https://github.com/actions/python-versions/releases/download/3.9.13-11183687820/python-3.9.13-darwin-arm64.tar.gz"
  Extract downloaded archive
  /usr/bin/tar xz -C /Users/anka/actions-runner/_work/_temp/88d733fe-3d68-4222-bfad-274b280a0c83 -f /Users/anka/actions-runner/_work/_temp/084fd4fb-7571-406e-99db-04b625fe9363
  Execute installation script
  Check if Python hostedtoolcache folder exist...
  Creating Python hostedtoolcache folder...
  Error: mkdir: /Users/runner: Permission denied
  Error: The process '/bin/bash' failed with exit code 1

Our macOS machines are not created with the runner user.

NorseGaud avatar Oct 30 '24 14:10 NorseGaud

I tried setting env: in the yaml but that doesn't work. Maybe someone has an example?

NorseGaud avatar Oct 30 '24 14:10 NorseGaud

Hello @NorseGaud, Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

mahabaleshwars avatar Nov 04 '24 06:11 mahabaleshwars

Hello, Thank you for your feature request and the thoughtful explanation. After reviewing the situation, we’ve decided not to implement an override for the default Python tool cache directory at this time. The solution to this issue is already outlined in our documentation, and we encourage users to refer to that guidance for resolving the permission-related errors on macOS self-hosted runners.

You can find the detailed solution here: Documentation

This documentation provides a reliable way to handle this scenario. Thank you for your understanding, and we appreciate your continued engagement with the project.

aparnajyothi-y avatar Feb 10 '25 08:02 aparnajyothi-y

Thanks @aparnajyothi-y , but that's not a reliable solution:

❯ whoami
nathanpierce
❯ mkdir /Users/runner
mkdir: /Users/runner: Permission denied

NorseGaud avatar Feb 10 '25 12:02 NorseGaud

Hi @NorseGaud, Thank you for your feedback. As outlined in our support policy, we are primarily focused on supporting hosted runners. The suggested solution in the documentation is the recommended approach for managing this issue with self-hosted runners. We recommend checking the permissions on the target directory or adjusting user permissions for the self-hosted runner.

We appreciate your understanding and continued engagement with the project. Thanks for your patience, and don’t hesitate to reach out with any further questions!

aparnajyothi-y avatar Feb 19 '25 13:02 aparnajyothi-y

Hello @NorseGaud, Please let us know in case of any further concerns or clarification on the above information.

aparnajyothi-y avatar Mar 07 '25 05:03 aparnajyothi-y

The documented solution won't work. People don't always have permission to create that directory...

NorseGaud avatar Mar 07 '25 13:03 NorseGaud

Hello @NorseGaud, Python packages for macOS are compiled into the /Users/runner/hostedtoolcache directory and must be installed there due to the fixed shared library path. To configure setup-python with a macOS self-hosted runner, ensure the following as mentioned in the documentation:

  1. Create /Users/runner/hostedtoolcache.
  2. Grant write access to the runner by adjusting directory permissions.

You can check the current user and group with ls -l. To grant access, change ownership with:

sudo chown runner-user:runner-group /Users/runner/hostedtoolcache

We appreciate your understanding and continued engagement with the project. Thanks for your patience, and don’t hesitate to reach out with any further questions!

aparnajyothi-y avatar Mar 21 '25 07:03 aparnajyothi-y

Hello @NorseGaud, Please let us know in case of any concerns/clarifications are required on the above.

aparnajyothi-y avatar Apr 03 '25 13:04 aparnajyothi-y

Hello @NorseGaud, Please let us know in case of any concerns/clarifications are required on the above.

aparnajyothi-y avatar Apr 11 '25 12:04 aparnajyothi-y

Not a real solution, sorry. I'll close this but this is a silly limitaiton.

NorseGaud avatar Apr 21 '25 11:04 NorseGaud