How to install a specific version of python using the VSC extension


I can see in the dockerfile generated by the extension that it requests python3:

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    python3-minimal \
    python3-pip \
    python3-setuptools \
    && rm -rf /var/lib/apt/lists/*

RUN pip3 install --upgrade pip
RUN pip3 install debugpy

Is there a way to set in the extension GUI a specific python version like 3.7?



Hi Kevin,

I don’t want to change necessarily, but to fix it so it doesn’t change unless I explicitly change it.

Carrier is custom, board is IMX8MM Verdin 1.1a



Dear @edwaugh,

it would be interesting to know the reason why you want to change the version to 3.7. Can you clarify?

Furthermore, I am curious to know your hardware setup. Can you state the SoM and carrier board you are using?

Best Regards

Ok, so maybe I just need to track the Debian version in use? What are the rules around how you change that? Can I expect to rebuild one day and get a new release?

Dear @edwaugh,

thanks for clarifying.

So, it is not possible to change the python version in the GUI of the VSC extension. At the moment we provide what bullseye provides by default. In the near future we will provide instructions on how to create your own platform and take full control of this.

Best Regards

You can check the python versions available per Debian release here: Python - Debian Wiki

As for making sure that a specific version of Python is in use, you have some options. You could freeze the Debian package feeds to a specific snapshot in time as we do in our Dockerfile here: debian-docker-images/Dockerfile at bullseye · toradex/debian-docker-images · GitHub

This will lock the version of Python to whatever was the version on the feeds at that time. Though this also freezes all other Debian packages as well.

You could also add an alternative Debian feed that provides the version of Python you’re interested in.

Finally I suppose you could also install the exact version of Python you want from the official Python source. Though this is a bit more involved as seen here: Managing Multiple Versions of Python on Ubuntu

Again these are just some suggestions though either way it’ll require some customization in the Dockerfile.

Best Regards,

Hi Jeremias,
Thanks for your answer, we have this on our backlog to try.