Reputation: 383
I am trying to setup circleci for a small project and I have the following configuration yml file:
version: 2.1
orbs:
python: circleci/[email protected]
jobs:
build-and-test:
docker:
- image: circleci/python:3.7.9
executor: python/default
steps:
- checkout
- python/load-cache
- run:
command: pip install -r src/requirements.txt
name: Install Deps
- python/save-cache
- run:
command: ./manage.py test
name: Test
workflows:
main:
jobs:
- build-and-test
In my github project, my requirements.txt
and dev_requirements.txt
files are located in a sub-directory called src
.
On the dashboard, I am getting the following errors:
error computing cache key: template: cacheKey:1:7: executing "cacheKey" at <checksum "requirements.txt">: error calling checksum: open /home/circleci/project/requirements.txt: no such file or directory
How do I resolve this issue?
Thank you
Upvotes: 1
Views: 1717
Reputation: 778
This Python orb is a little out of date, but the answer is the same for both the older and the current orb. To specify the location of the requirements file, which is what is needed for Circle to create the checksum that it uses to determine whether the requirements have been updated or not (whether it needs to d/l new ones or use the cache). These two commands take the place of python/load-cache
and python/save-cache
:
- restore_cache:
keys:
- v1-dependencies-{{ checksum "YOURPATH/requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "YOURPATH/requirements.txt" }}
Upvotes: 1