question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Four days ago, Python installed to /opt/hostedtoolcache, but today it installed to .../_work/_tool.

See original GitHub issue

Description: Four days ago, Python installed to /opt/hostedtoolcache, but today it installed to .../_work/_tool. This manifested as a failure to find Python.h while building the native dependencies of python-ldap. Somehow, the installation procedure of python-ldap knew to put -I/opt/hostedtoolcache/Python/3.8.10/x64/include/python3.8 on the command line, but there was nothing in the /opt/hostedtoolcache folder. I’m currently working around this by setting the AGENT_TOOLSDIRECTORY environment variable to /opt/hostedtoolcache in my workflow.

Action version: b55428b1882923874294fa556849718a1d7f2ca5

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version: 3.8.10

Repro steps:

      - name: Install Python 3.8.10
        uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5
        with:
          python-version: '3.8.10'

Expected behavior: I would expect this to install Python to /opt/hostedtoolcache like it previously did.

Actual behavior: It now installs Python to .../_work/_tool within the job’s workspace.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13

github_iconTop GitHub Comments

3reactions
jatobencommented, Aug 24, 2022

I encountered this as well, although the self-hosted runner I’m using has not used /opt/hostedtoolcache since it was installed months ago. /opt is completely empty and the runner user does not have write access to it; actions/setup-python appears to have always put Python in the _work/_tool subdirectory.

Since I did not want to change the runner’s configuration, I worked around the problem by setting the CFLAGS env var in my actions workflow, e.g.:

- name: build dependencies
  env:
    CFLAGS: "-I/path/to/runner/_work/_tool/Python/3.10.1/x64/include/python3.10"
  run: ...

This let my build find Python.h successfully.

However, nothing has changed recently with the runner, the workflow, or the Python version I’m using, so I’d love to understand why it’s now getting the include path wrong.

1reaction
szhekpisovcommented, Aug 23, 2022

Was able to apply a workaround by adding an environmental variable, as TS mentioned:

name: Back-End quality gate

env:
  AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Github action using wrong version of Python - Stack Overflow
I set up the same thing with a new workflow, there's no cache, I am using cache-dependency-path explicitly, and you have to install...
Read more >
Changelog — Python 3.11.1 documentation
gh-98745: Update py.exe launcher to install 3.11 by default and 3.12 on request. ... before sys.path is extended to include the current working...
Read more >
Bug listing with status CONFIRMED as at 2022/12/26 10:46:31
Allow packages to be simultaneously installed. ... Bug:70337 - "EpsonEPLIJS utility to get Epson EPL working with cups" status:CONFIRMED resolution: ...
Read more >
30371 (Use pipenv to create venv for development) - Sage Trac
It generates a virtual env in src/.venv that contains all necessary Python packages, and an editable install of sage. Moreover, the installation of...
Read more >
A Complete Guide to Python DateTime Functions - ListenData
This tutorial explains python datetime module in detail and how it is used ... as it comes bundled with the installation of python...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found