Upgrading to the convenience image breaks everything

Hey :slight_smile:

until recently, we have used the following image for our django project on circleci:

image: circleci/python:3.9.7-node-browsers

Now we are eager to upgrade to the new convenience image:

image: cimg/python:3.9.10-browsers

However, this breaks on step Install backend dependencies with the following error:

#!/bin/bash -eo pipefail
python3.9 -m venv venv
source venv/bin/activate
pip3.9 install -r requirements-dev.txt

Error: [Errno 2] No such file or directory: '/home/circleci/project/venv/bin/python3.9'

Exited with code exit status 1
CircleCI received exit code 1

Here is the CircleCI config.yml :slight_smile:

version: 2.1
workflows:
  version: 2
  build_and_test:
    jobs:
      - build:
          filters:
            branches:
              ignore: /^master$/
aliases:
  images:
    python-node-docker-image: &python-node-docker-image
      image: cimg/python:3.9.10-browsers
    postgres-docker-image: &postgres-docker-image
      image: postgres:12.9-alpine
jobs:
  build:
    docker:
      - *python-node-docker-image
      - *postgres-docker-image
    resource_class: large
    steps:
      - checkout
      - run:
          name: "Install system dependencies"
          command: |
            sudo apt-get update && sudo apt-get install -y gettext && sudo npm install -g npm@7
      - restore_cache:
          key: venv-{{ checksum "requirements-dev.txt" }}
      - run:
          name: "Install backend dependencies"
          command: |
            python3.9 -m venv venv
            source venv/bin/activate
            pip3.9 install -r requirements-dev.txt
      - save_cache:
          key: venv-{{ checksum "requirements-dev.txt" }}
          paths:
            - "venv"

      - run:
          name: "Compile backend translations"
          command: |
            source venv/bin/activate
            ./scripts/compile-backend-messages.sh
      - run:
          name: "Backend type-check"
          command: |
            source venv/bin/activate
            ./scripts/type-check-backend.sh
      - run:
          name: "Backend tests"
          command: |
            source venv/bin/activate
            python3.9 manage.py test
      - persist_to_workspace:
          root: .
          paths:
            - venv
            - locale
      - store_artifacts:
          path: /tmp/artifacts
      - store_artifacts:
          path: test-results
      - store_test_results:
          path: test-results

Is there anything particulary wrong with this? Could not find anything in the docs about this :confused: The code itself did not change besides the image!
I SSH’d into the seesion and could actually do the step of installing manually… :frowning: So I am not sure, what could be wrong here. This config has always been working fine. I have ommited some of the frontend steps, since they arent necessary here.

I am happy for any pointers you could give me!
Thanks a lot :slight_smile:

Hi @Thorbenl, I had a similar problem, but it turned out the virtualenv stored in my cache wasn’t compatible with the new images. All you should need to do here is change your cache key. (One good practice is to have a version number in the key so it’s easy to change.)

Here’s an example from a project I maintain: Upgrade to new CircleCI convenience image by Mr0grog · Pull Request #763 · edgi-govdata-archiving/web-monitoring-processing · GitHub

Hey :slight_smile:
Thanks! that actually worked.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.