Local client runs builds in the wrong container

circle.yml
cli

#1

I am attempting to validate my build processes by running Circle on my local system. I am also evaluating this as a replacement process for my team to ensure that they are building using the same process as the CI server.

One of my builds is a multi-container build. In the first container, I have Python3 and several additional libraries pre-installed. The other two containers are a postgres and redis container.

During the build process locally, The python build commands are being executed in a container that does not actually contain Python3. When I start the container I intend to use and run the commands manually, the commands work. Finally, the same circle configuration file works in Circle itself.

Here are some snippets out of my circle configuration:

---
version: 2
jobs:
  build:
    docker:
      - image: savannidgerinel/python-node-primary:0.0.3
      - image: circleci/postgres:9.5
      - image: redis

    working_directory: ~/repo

    steps:
      - checkout

      - restore_cache:
          key: venv-{{ checksum "requirements.txt" }}

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install --upgrade pip
            pip install wheel
            pip install -r requirements.txt

And then here is the error:

====>> install dependencies
  #!/bin/bash -eo pipefail
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install wheel
pip install -r requirements.txt

Unable to symlink '/usr/bin/python3' to '/root/repo/venv/bin/python3'
/bin/bash: /root/repo/venv/bin/pip: /home/savanni/src/MyProject/venv/bin/python3: bad interpreter: No such file or directory

#2

When you a run a local build we mount the working directory to the main docker container. This is why it is expecting to find a python3 interpreter in /home/savanni/src/MyProject/venv/bin/python3 which I assume is your project root on your local computer.

You should create a python3 venv locally in that same directory and it should work.


#3

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