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.

Periodic "bad interpreter" when caching virtual environments

See original GitHub issue

Describe the bug When testing large projects it is convenient to cache dependencies from pypi with a cache key based on the projects setup.py. I’ve been been using that pattern (yaml shown below) on several projects for > 6 months. It works great, but periodically (every 1-6 weeks) fails with the error:

Screen Shot 2021-01-21 at 6 00 02 AM

Once the error occurs once, it will appear consistently until I alter the cache key and force the virtual environment to rebuild.

I think what’s happening is that every time the build/setup for the setup-python action changes, it invalidates the link between the virtual environment and the python binary.

Questions:

  • Is there a recommended method for caching dependencies with setup-python that will not suffer from this issue
  • Could you recommend file/something that can be hashed and added to the cache key to invalidate the cache when new python builds are pushed?
    steps:

    - name: set up python 3.8
      uses: actions/setup-python@v1
      with:
        python-version: 3.8

    - name: checkout
      uses: actions/checkout@v2

    - name: cache dependencies
      id: xyz-cache
      uses: actions/cache@v2
      with:
        path: venv
        key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}-0

    - name: install xyz
      if: steps.sl-cache.outputs.cache-hit != 'true'
      run: |
        python -m venv venv
        source venv/bin/activate
        python -m pip install --U pip setuptools wheel
        pip install -e ".[dev]"

Thanks!

Which version of the action are you using?

  • v1
  • v2
  • Some other tag (such as v2.0.1 or master)

Environment

  • self-hosted
  • Linux
  • Windows
  • Mac

Python Versions At least all versions of 3.7 and 3.8 but probably all of them

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
panticmiloscommented, May 30, 2022

Hi @marcosschroh,

Just to let you know we are taking a deeper investigation into what is exactly happening here.

Cheers

1reaction
oliricecommented, Jan 21, 2021

The folks over at poetry seem to have run into the same issue

They do this: https://github.com/python-poetry/poetry/blob/master/.github/workflows/main.yml#L55

I’d appreciate a nod if that’s the recommended solution

Read more comments on GitHub >

github_iconTop Results From Across the Web

virtualenv error bad interpreter: No such file or directory
In my case I was renaming project and project's folder where venv has been located. So in my case I was changing paths...
Read more >
virtualenv - Release 20.10.0 unknown
Phase 1 discovers a python interpreter to create a virtual environment from (by default this is the same python.
Read more >
virtualenv(1) — Arch manual pages
Phase 1 discovers a python interpreter to create a virtual environment from (by default this is the same python as the one virtualenv...
Read more >
Authentication and Kerberos Issues | CDP Private Cloud
Steps to resolve: Examine the Kerberos tickets currently in your credentials cache by running the klist command. You can obtain a ticket by...
Read more >
Considerations in adopting RHEL 8 Red Hat Enterprise Linux 8
This affects both bare metal and virtual environments. However, the newer e1000e network driver continues to be fully supported in RHEL 8. 11.1.3.4....
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