Issue running setup-python on macos self-hosted runner

I have installed a self hosted runner and facing the following error when using 

actions/setup-python@v2

  Set up Python

48s

11##[error]The process ‘/bin/bash’ failed with exit code 1

1 Run actions/setup-python@v2

2 with:

3 python-version: 3.7

4 token: ***

5Version 3.7 was not found in the local cache

6Version 3.7 is available for downloading

7Download from “https://github.com/actions/python-versions/releases/download/3.7.7-20200429.25/python-3.7.7-macos-1014-x64.tar.gz

8Extract downloaded archive

9/usr/bin/tar xz -C ./9a9dead8-056b-4f41-81eb-197cf522b876 -f /Users/alleon_g/Documents/0x-TechWork/actions-runners/_work/_temp/9a9dead8-056b-4f41-81eb-197cf522b876

10Execute installation script

11##[error]The process ‘/bin/bash’ failed with exit code 1

The Worker log is not that helpful indicating a process is starting and few line later exiting with an error code1. 
Moreover I have defined the RUNNER_TOOL_CACHE env variable which does not seem to be taken into account (I am using zsh). I am quite sure it is not set at the proper location as I am not sure the Worker is reading the env file. Where shall it be placed ?

Thanks

@galleon ,

According to the docs about the setup-python action (see here):

1) When running the setup-python action on a self-hosted runner, you do not need to define the environment variable RUNNER_TOOL_CACHE on your machine. When the setup-python action is running for the first time with a version of Python that isn’t installed, it will download the appropriate version, and set up the tools cache on your machine.

2) When the setup-python action is first setting up the tools cache on self-hosted runner:

  ◆ On Windows, your runner needs to be running as an administrator so that the appropriate directories and files can be setup.

  ◆ On Linux and Mac, you also need to be running with elevated permissions.

Please make sure you have elevated permissions when running the self-hosted runner on your macOS machine.

If the problem still occurs, you can open an issue ticket in the repository of the setup-python action (actions/setup-python) to get more help from the appropriate engineering team.

In addition, you also can try enabling debug logging to see if you can get more detailed infomation about the errors.

1 Like

Thanks for your answer. What is the best solution to run with elevated rights on macos since all shell scripts are checked against running as root (i.e. sudo) ?

I initially changed the svc.sh script to add sudo in front of launchctl but it did not make it any better.

Thanks

Guillaume

@galleon ,

I think you should add sudo when starting the runner as a service.

Please try this:

sudo ./svc.sh start

@galleon ,

Looks like, there some issues about tools cache on the  setup-python action (actions/setup-python#89).

The problem you are facing should be also related to this issue.

You can follow that issue ticket and add your comments on that ticket.