Hi,
I am trying to cache Pipfile.lock so that it won’t install packages every time there is a new PR on GitHub.
I have following yml fie with ~/repo working directory where I expect Pipfile.lock is generated when it is run first time.
working_directory: ~/repo
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
- restore_cache:
keys:
- pip-packages-v2-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- pip-packages-v2-{{ .Branch }}-
- pip-packages-v2-
- run:
command: |
sudo pip install pipenv
pipenv install pylint==2.3.1
pipenv install coverage==4.5.4
pipenv install codecov
- save_cache:
paths:
- "Pipfile.lock"
- ".venv"
- "/usr/local/bin"
- "/usr/local/lib/python3.7/site-packages"
key: pip-packages-v2-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
I can observe that it can save the cache for Pipfile.lock on this run:
Creating cache archive...
Uploading cache archive...
Stored Cache to pip-packages-v2-trial_for_caching-fLO_sHc3LZMo6nllZ+D+MtbukInwzDlOgIfcHglCUS4=
* /home/circleci/repo/Pipfile.lock
* /home/circleci/repo/.venv
* /usr/local/bin
* /usr/local/lib/python3.7/site-packages
but when I run it again, it cannot find the Pipfile.lock file with the following error:
error computing cache key: template: cacheKey:1:33: executing "cacheKey" at <checksum "Pipfile.lo...>: error calling checksum: open /home/circleci/repo/Pipfile.lock: no such file or directory
I could never manage to cache and use it again and I have checked the following links:
- https://circleci.com/docs/2.0/language-python/#cache-dependencies
- https://circleci.com/docs/2.0/caching/
How to overcome this issue?