[Python] Github Actions setup-python not caching pip dependencies

Discussão em 'Python' iniciado por Stack, Agosto 3, 2025.

  1. Stack

    Stack Membro Participativo

    Why is Github Action's setup-python action's cache still making pip install all the dependencies?

    I have this simple workflow

    name: Python Testing

    on:
    push:
    branches: [ master ]
    pull_request:
    branches: [ master ]

    permissions:
    contents: read

    jobs:
    coverage_check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-python@v4
    with:
    python-version: "3.6"
    cache: 'pip' # caching pip dependencies
    - run: pip install -r requirements.txt --use-deprecated=legacy-resolver



    From the logs, it's a cache hit

    Successfully set up CPython (3.6.15)
    /opt/hostedtoolcache/Python/3.6.15/x64/bin/pip cache dir
    /home/runner/.cache/pip
    Received 123461741 of 123461741 (100.0%), 111.2 MBs/sec
    Cache Size: ~118 MB (123461741 B)
    /usr/bin/tar --use-compress-program unzstd -xf /home/runner/work/_temp/a5d8f986-ce6b-424f-8de9-c082916cdb2f/cache.tzst -P -C /home/runner/work/backend/backend
    Cache restored successfully
    Cache restored from key: setup-python-Linux-20.04-Ubuntu-python-3.6.15-pip-d0b220da2d89ebae7a0978e97e9d1ce87061e5e2e0f5d3d242c2770b7f983de6



    Yet the python dependencies are installed

    Collecting Flask-Cors==3.0.9
    Using cached Flask_Cors-3.0.9-py2.py3-none-any.whl (14 kB)
    Collecting Flask-GraphQL==2.0.1
    ....


    I expected dependency to be already present and return something like this

    Requirement already satisfied: Flask-Cors==3.0.9 in
    ....

    Continue reading...

Compartilhe esta Página