d3ming
d3ming

Reputation: 9080

How do I cache 'pip install' packages on 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

Upvotes: 7

Views: 3415

Answers (1)

d3ming
d3ming

Reputation: 9080

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

Upvotes: 3

Related Questions