Python3 command not found

Hi, I’m using python as a secondary docker image, and it keeps giving me a pretty scary ‘job was canceled’ message. I’m wondering if that’s what is responsible for python3 not found error?

My job is pretty simple to start:

python --version
python3 --version
python3.7 --version
which -a python

It fails on the second line, after outputting "Python 2.7.9" (note that the primary docker image is circleci/node:8.11.1)

The secondary one I’m trying to use is circleci/python:3.7.2 .

Any ideas? Thanks!

python3 does not exist in circleci/python:3.7.2 the only version of python that is installed is the one you see in the tag. In these images python == python3

On circleci/node:8.11.1, python3 is not installed at all so python == python2.

Could you share more of what you are trying to accomplish here?

Oh, but my config asks for both?

    working_directory: ~/workspace
      - image: circleci/node:8.11.1
      - image: circleci/python:3.7.2

Basically I have a monorepo with many independent projects.

I have a simple python3 script I want to run that checks what sets of tests / lints / checkstyles need to be run, depending on what folders have changed. So if you’re only changing folder A, run tests A, and if changing folder B, run tests B, etc.

I’ve validated this script works, but lo and behold when I try to run it on python 3, it fails. And python --version shows Python 2.7.9

EDIT: We also have python in our repo, so I just defaulted to python3 so that we could have all our codebase run a single version fo python, with those same style checkers, etc. So it’s definitely not a blocker if I have to write a python2 script for this.

You can only use one image at a time to execute commands. All of your steps execute in the first container that is listed. Any secondary containers are there as “services” – so they are designed to run things like redis, MySQL, etc.

If you need an image with both node and python3, I don’t think one exists at the moment. You can either make your own image, or install python3 as a part of the build. (or vice versa, install node as a part of the python container).

Ah gotcha; that clears up my misunderstanding. Thanks!

1 Like

My pleasure, also I lied there is totally an image that has node + python.

It is called circleci/python:$VERSION-node – note this is the LTS version of node so it may not be good enough for your use case, but just FYI.

You can see all the variants of all the things here: :slight_smile:

1 Like

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