installing python 3.10.2 on pop!_os 20.10

Running Python 3.10.2 in a virtual work environment.

You should have seen this one coming.

Pop!_OS 21.10 comes with Python 3.9.7. That’s a decent version for quite a few tasks. But I want my Python release to be as fresh as possible. I checked the Python website ( https://www.python.org/ ) and discovered that versions 3.9.10 and 3.10.2 had been released on 14 January. I’m not in the mood to install the latest Python 3.9 release, so I built and installed 3.10.2.

I’ve been building Python for some time now (just search for it on my site). The last big installation was 3.9.1 on a Xavier NX running Ubuntu 18.04 and JetPack 4.5 back on February 2021 ( /2021/02/14/building-python-3-9-1-on-jetpack-4-5-and-the-jetson-xavier-nx/ ). You’re welcome to go back and read that, but I’m going to wrap up all those directions here, and add a few bits to make Python build with all modules on what is essentially Ubuntu 21.10.

Install Build Prerequisites

In addition to all the prerequisites from other builds, I found that there were a few holes in the base Pop!_OS installation. If you want to just get everything on one line and then install it all, copy the following and then paste into a bash shell.

sudo apt install zlib1g-dev \libncurses5-dev \libgdbm-dev \libnss3-dev \libssl-dev \libreadline-dev \libffi-dev \libsqlite3-dev \libbz2-dev \tk \tk-dev \liblzma-dev \libgdbm-compat-dev

Build And Install Python 3.10.2

  • Download the latest Python version from https://www.python.org/downloads/
  • Untar the file into a work folder of your choice
  • Make a build directory at the same level as the untarred source directory.
  • From within the build directory execute the configure script. In this example we’re building Python 3.10.2.
    ../Python-3.10.2/configure --enable-optimizations
  • Within the build directory run make.
  • Install into the alternate location for this version of Python:
    sudo -H make altinstall
  • Check for the alternate location with which python3.10 . It should return /usr/local/bin/python3.10 .

Create A Virtual Work Environment

  • In your home directory create a work folder. On my system I named it ‘vpython’, but you can call it whatever you want.
  • Change directory into it, then create a Python VE using as an example python3.10 -m venv 310.
  • There is a bin directory in the virtual directory you created, which in this example was 310. Start the environment with source 310/bin/activate .

I created an alias so that typing activate in any shell starts the environment. The alias should source the full path and the script in bin. When active, typing deactivate drops you back to a regular shell environment. See the example screen capture above for examples and some ideas.

And that’s it. Easy-peasy as they say.

building python 3.10.1 on jetpack 4.5.1 and the jetson xavier nx

This is a follow-up to my last Python build and installation back in February ( /2021/02/14/building-python-3-9-1-on-jetpack-4-5-and-the-jetson-xavier-nx/ ). That post has all the directions for setting up a build environment including installation of all packages. This time I downloaded the source to Python 3.10.1, unpacked it, and built it. I then performed an alt-install as before. Everything went well until the very end, when the alt-install process spit this out (see all the highlighted lines):

WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/10151>distutils: /usr/local/include/python3.10/UNKNOWNsysconfig: /ssd/jetson/Python-3.10.1/Include/UNKNOWNWARNING: Additional context:user = Falsehome = Noneroot = '/'prefix = NoneLooking in links: /tmp/tmplaxd5qzjProcessing /tmp/tmplaxd5qzj/setuptools-58.1.0-py3-none-any.whlProcessing /tmp/tmplaxd5qzj/pip-21.2.4-py3-none-any.whlInstalling collected packages: setuptools, pip  WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/10151>  distutils: /usr/local/include/python3.10/setuptools  sysconfig: /ssd/jetson/Python-3.10.1/Include/setuptools  WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/10151>  distutils: /usr/local/include/python3.10/pip  sysconfig: /ssd/jetson/Python-3.10.1/Include/pipSuccessfully installed pip-21.2.4 setuptools-58.1.0WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

I have never had a problem before now, and I suspect it’s all to do with Python 3.10. I went looking for an explanation and fix ( see https://stackoverflow.com/questions/67244301/warning-value-for-scheme-data-does-not-match-when-i-try-to-update-pip-or-inst for example), but the explanation(s) are confusing, with the general consensus as “don’t worry about it.” Which I consider crap.

So far 3.10.1 seems to work, with one notable exception: you can’t install PyQt6, as there is no qt6-default support package, and PyQt6 won’t build without it. You’re thus stuck with PyQt5.

Determining Various Version Numbers

This section is primarily for me to remember for the future. I’m tired of looking it up.

To determine what version of Ubuntu you’re running:

$ cat /etc/os-release NAME="Ubuntu"VERSION="18.04.6 LTS (Bionic Beaver)"ID=ubuntuID_LIKE=debianPRETTY_NAME="Ubuntu 18.04.6 LTS"VERSION_ID="18.04"HOME_URL="https://www.ubuntu.com/"SUPPORT_URL="https://help.ubuntu.com/"BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"VERSION_CODENAME=bionicUBUNTU_CODENAME=bionic$

To determine what version of Jetpack you’re running:

$ sudo apt-cache show nvidia-jetpackPackage: nvidia-jetpackVersion: 4.5.1-b17Architecture: arm64Maintainer: NVIDIA Corporation...