On CircleCI 2.0 we recommend using different container images for different language versions.
Or you could find or create a Docker image that has pyenv and the other requirements preinstalled.
Another alternative is to install them during the job as dependencies (e.g. pip instaling tox will be fast and can be done on each build if you wish)
Here’s an example of using multiple containers to do a matrix style build:
version: 2.0
shared: &shared
working_directory: ~/circleci-demo-workflows
steps:
- checkout
- run: bundle install --path vendor/bundle
- run: bundle exec rake db:create db:schema:load
- run:
name: Run tests
command: rake
jobs:
"ruby-2.2":
<<: *shared
docker:
- image: circleci/ruby:2.2-node
- image: circleci/postgres:9.4.12-alpine
"ruby-2.3":
<<: *shared
docker:
- image: circleci/ruby:2.3-node
- image: circleci/postgres:9.4.12-alpine
"ruby-2.4":
<<: *shared
docker:
- image: circleci/ruby:2.4-node
- image: circleci/postgres:9.4.12-alpine
workflows:
version: 2
build:
jobs:
- "ruby-2.2"
- "ruby-2.3"
- "ruby-2.4"
This is using a feature of YAML called ‘anchors’ to reduce repetition.