Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I cache 'pip install' packages on CircleCI?

Tags:

circleci

Is there a way to do this?

For example, I currently always install a specific version of docker-compose in the circle.yml file but I'd like this to be installed already via cache:

- sudo -H pip install -U docker-compose==1.3.3

I tried adding the following to the circle.yml but it doesn't work (nothing related to docker-compose was saved in the .cache/pip dir after the install):

 cache_directories:
    - /home/ubuntu/.cache/pip
like image 989
d3ming Avatar asked Sep 05 '15 07:09

d3ming


Video Answer


1 Answers

Thanks to the help from Alexey (from Circle), got the solution:

Use a requirements.txt to install pip dependencies, i.e.:

docker-compose == 1.3.3

Modify the circle.yml file to add python as a dependency and do the pip install:

machine:
  python:
    version: 2.7.6

dependencies:
  pre:
    - pip install -r requirements.txt
like image 69
d3ming Avatar answered Sep 30 '22 19:09

d3ming