Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Flake8 don't save in cache pip

sbarrio February 13, 2020

Hey,

In the bitbucket pipelines file I install the python dependences in the first step and it fails in the next step when I try to run flake8 command:

pipelines:
default:
- step:
name: Install dependencies
caches:
- pip
script:
- pip install -r requirements.txt

- step:
name: Test Flake8
caches:
- pip
script:
- flake8 -v api

In the second step I get the following error:

bash: flake8: command not found

1 answer

0 votes
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 13, 2020

Hello @sbarrio,

Welcome to the Community!

Pipeline steps are independent, each of them runs in a fresh Docker container. When you run pip install, it not only downloads the dependencies (cache might help here) but also installs it. E.g. puts flake8, for instance, somewhere on the PATH. So even if the cache works, flake8 won't be available in the next step, only in the next commands of the same script within one step.

In addition to this note that caches are saved on successful builds when the cache is empty. This means that when you update dependencies, the cache won't pick them up until it expires (this happens in 1 week from creation date). See this page for details.

Also, you shouldn't rely on caches in any way. They're meant to speed up the build but they shouldn't be required to run it, e.g. they can be emptied at any time.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events