It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Flake8 don't save in cache pip

sbarrio I'm New Here Feb 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

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
Community showcase
Posted in Bitbucket

Contest: Share your custom Bitbucket Pipe and win

Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...

1,037 views 4 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you