Describe the bug
Caching venv si common practice as documented. However, on cimg/python, python -m venv venv produces a virtual environment with a symlink to a fixed x.y.z python version (/home/circleci/.pyenv/versions/3.11.10/bin/python for instance on cimg/python:3.11.
This causes . venv/activate to fail with Error: [Errno 2] No such file or directory: 'venv/bin/python' as soon as the image is updated with a new minor Python version.
To Reproduce
Using the following config.yml:
jobs:
build:
docker:
- image: cimg/python:3.11.4
steps:
- checkout
- restore_cache:
keys:
- << pipeline.parameters.cache-version >>-{{ checksum "Pipfile.lock" }}
- << pipeline.parameters.cache-version >>-
- run:
name: install dependencies
command: |
python -m venv /tmp/venv
. /tmp/venv/bin/activate
pip install pipenv
pipenv install --dev
- save_cache:
paths:
- /tmp/venv
key: << pipeline.parameters.cache-version >>-{{ checksum "Pipfile.lock" }}
Change the used image from cimg/python:3.11.4 to cimg/python:3.11 and the CI should fail with the No such file or directory error.
Expected behavior
Caching the venv should not make the CI to suddenly fail as soon as the Python minor changes when using cimg/python:x.y.
Workarounds
Use cimg/python:x.y.z instead of cimg/python:x.y wich is inconveniant.
Describe the bug
Caching venv si common practice as documented. However, on
cimg/python,python -m venv venvproduces a virtual environment with a symlink to a fixed x.y.z python version (/home/circleci/.pyenv/versions/3.11.10/bin/pythonfor instance oncimg/python:3.11.This causes
. venv/activateto fail withError: [Errno 2] No such file or directory: 'venv/bin/python'as soon as the image is updated with a new minor Python version.To Reproduce
Using the following
config.yml:Change the used image from
cimg/python:3.11.4tocimg/python:3.11and the CI should fail with the No such file or directory error.Expected behavior
Caching the venv should not make the CI to suddenly fail as soon as the Python minor changes when using
cimg/python:x.y.Workarounds
Use
cimg/python:x.y.zinstead ofcimg/python:x.ywich is inconveniant.