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

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

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,792 views 10 16
Read article

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