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

Bug: `"pip"` cache having nothing installed leads to post-run error

Open jamesbraza opened this issue 1 year ago • 4 comments

Description:

I have this:

        runs-on: 'ubuntu-latest'
        steps:
            -   uses: actions/setup-python@v5
                with:
                    python-version: '3.10'
                    cache: 'pip'

Bumping python-version from '3.10' to '3.12', I am now getting this error during Post Run actions/setup-python@5:

Post job cleanup.
Error: Cache folder path is retrieved for pip but doesn't exist on disk: /home/runner/.cache/pip

Action version:

v5

Platform:

  • [x] Ubuntu
  • [ ] macOS
  • [ ] Windows

Runner type:

  • [x] Hosted
  • [ ] Self-hosted

Tools version:

3.10.13 to 3.12.1

Expected behavior:

I expect setup-python to somehow not error itself.

Seemingly related issues:

  • https://github.com/actions/setup-python/issues/653
  • https://github.com/actions/setup-python/issues/436

Actual behavior:

Here is the output of Run actions/setup-python@v5

  with:
    python-version: 3.12
    cache: pip
    check-latest: false
    token: ***
    update-environment: true
    allow-prereleases: false
  env:
    ...
Installed versions
  Successfully set up CPython (3.12.1)
/opt/hostedtoolcache/Python/3.12.1/x64/bin/pip cache dir
/home/runner/.cache/pip
pip cache is not found

Here is the output of Post Run actions/setup-python@5:

Post job cleanup.
Error: Cache folder path is retrieved for pip but doesn't exist on disk: /home/runner/.cache/pip

jamesbraza avatar Feb 07 '24 21:02 jamesbraza

Okay, I figured it out, the issue was not pip installing anything! 😆

pip installing some placeholder package like isort solves the problem, the error goes away.

Thus the conclusion is, if "pip" cache is specified, then post run caching should either:

  • Be robust against no packages being installed into pip cache
  • Throw a better error (e.g. "Cache folder path is retrieved for pip but doesn't exist on disk, did you actually pip install anything?")

jamesbraza avatar Feb 07 '24 21:02 jamesbraza

Hello @jamesbraza Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

HarithaVattikuti avatar Feb 07 '24 22:02 HarithaVattikuti

Hi @jamesbraza 👋 , Thank you for sharing your experience and suggestions! Your insights into enhancements for post-run caching are valuable. We’ll work on it when we get the chance. For now I'm going to close the issue. If you have any concerns please feel free to ping us. We appreciate your understanding and cooperation :)

priyagupta108 avatar Feb 21 '24 06:02 priyagupta108

Usually an issue stays open until it's resolved, not closed as completed when it wasn't.

Think of issues as targets to aim for, but closing them defeats that

jamesbraza avatar Feb 21 '24 06:02 jamesbraza