How can I use pip cache in github actions?

You forgot about adding id in step which uses actions/cache. This is required for condition in Install step to work.

- uses: actions/cache@v1
  id:   cache
  with:
   ...

You can also cache a virtualenv, like this:

    - uses: actions/cache@v2
      id: cache-venv  # name for referring later
      with:
        path: ./.venv/  # what we cache: the virtualenv
        # The cache key depends on requirements.txt
        key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements*.txt') }}
        restore-keys: |
          ${{ runner.os }}-venv-
    # Build a virtualenv, but only if it doesn't already exist
    - run: python -m venv ./.venv && . ./.venv/bin/activate && 
           pip install -r requirements.txt
      if: steps.cache-venv.outputs.cache-hit != 'true'
    # Run tests
    # Note that you have to activate the virtualenv in every step
    # because GitHub actions doesn't preserve the environment
    - run: . ./.venv/bin/activate && nosetests tests/