Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Periodic "bad interpreter" when caching virtual environments #182

@olirice

Description

@olirice

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions