building python 3.8.3 on jetpack 4.4 dp and the jetson xavier nx

This how-to is a refinement of my first Python 3.8.3 from 16 May build, built on the older Jetson Nano with JetPack 4.4 DP ( /2020/05/16/building-python-3-8-3-on-jetpack-4-4-developer-preview/ ). Where changes have occurred, they are noted.

These instructions will help you build Python 3.8.3 on the Jetson Xavier NX Development Kit running JetPack 4.4 Developer Preview. There are two broad steps to building this version. The first is the installation of support developer libraries to allow as many Python modules as possible to successfully build. After the installation step, then comes the build steps. This was reversed in the 16 May build how-to.

To build as many modules as possible the following libraries need to be installed.

  • libgdm-dev
  • libnss3-dev
  • libssl-dev
  • libsqlite3-dev
  • libreadline-dev
  • libbz2-dev
  • libdb-dev, libdb++-dev (Berkeley db)
  • libgdbm-dev
  • libffi-dev

And for those of you following along who just want to copy and paste one time, the single line command to install all the libraries at once is:

sudo apt install libgdm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libbz2-dev libdb-dev libdb++-dev libgdbm-dev libgdbm-dev libffi-dev

The package libffi-dev was not in the installation list from 16 May. If not installed then then module _ctypes will fail to build.

  1. If you haven’t done so already then download the latest Python, version 3.8.3, from https://www.python.org/downloads/.
  2. Untar the file (we’ll assume it’s downloaded to the default ~/Downloads):
    tar xvf Downloads/Python-3.8.3.tar.xz
  3. Make a build directory at the same level as the untarred source directory. In this case the build directory was named build-python-3.8.3
  4. Change directory into the build directory.
  5. From within the build directory execute the configure script:
    ../Python-3.8.3/configure --enable-optimizations
  6. Run make:
    make -j 6

    Note that we’re using all six cores of the Jetson Xavier NX. This means that all six cores should be enabled on the NX.

  7. Install into the alternate location for this version of Python:
    sudo -H make altinstall
  8. Check for the alternate location with ‘which python3.8’. It should return ‘/usr/local/bin/python3.8’.

I then created a Python 3.8.3 virtual work environment. These are the specific steps I used to create that environment.

  1. In your home directory, create a work folder. In this example it was named ‘venv383’. Change directory (cd) into it.
  2. Then create a Python VE:
    python3.8 -m venv app01

Once created, you should have a directory structure like this:

├── bin/│   ├── activate│   ├── activate.csh│   ├── activate.fish│   ├── easy_install│   ├── easy_install-3.8│   ├── pip│   ├── pip3│   ├── pip3.8│   ├── python -> python3.8│   ├── python3 -> python3.8│   └── python3.8 -> /user/local/bin/python3.8├── include/├── lib/│   └── python3.8/│   └── site-packages/│   ├── easy_install.py│   ├── pip/...│   ├── pip-19.2.3.dist-info/...│   ├── pkg_resources/...│   ├── __pycache__/...│   ├── setuptools/...│   └── setuptools-41.2.0.dist-info/...├── lib64 -> lib/└── pyvenv.cfg

To active the virtual environment, you would execute

source bin/activate

In my environment I created a Bash alias to handle that:

alias activate='source $HOME/venv383/app01/bin/activate'

Note that this incorporates the folder and virtual environment name I personally created earlier. If you change any of that then you’ll incorporate what you created.

Here’s a quick run to see if those bits are working properly.

And so it would appear that they do.

bringing up jetson xavier nx developer kit

Jetson Xavier NX with JetPack 4.4 DP building emacs 28 with all six ARM cores

The Jetson Xavier NX Developer kit arrived today. I have installed JetPack 4.4 Developer Preview, just like I did with my Jetson Nano. I also moved my Crucial 500GiB SSD over and plugged it into the NX. JP 4.4 was flashed onto a SanDisk 128GB SDXC Extreme Plus V30 XC1 U3 A2 (yeah, I know). After initial poweron and setup, the card has 117GiB total storage, with 13GiB of it used so far.

First things I installed were pip, curl, htop, and jtop.

With the SSD installed I moved over to the emacs build area and prepared to build and install emacs, just like I’d done on my Nano. For that I installed the following libraries (again):

  • texinfo
  • libxaw7-dev
  • libjpeg-dev
  • libpng-dev
  • libgif-dev
  • libtiff-dev
  • gnutls-dev
  • libncurses-dev
  • libfreetype6-dev
  • libcairo-dev
  • libgif-dev

The last entry, libgif-dev, was missing in my original post about building emacs. I’d picked it up when I built python 3.8.3 first. This time I built emacs first, just to test my original build directions, and found the hole in my installation. Of note is what apt printed to the console when installing three of the libraries:

Note, selecting 'libgnutls28-dev' instead of 'gnutls-dev'Note, selecting 'libncurses5-dev' instead of 'libncurses-dev'Note, selecting 'libcairo2-dev' instead of 'libcairo-dev'

Everything built and linked successfully in spite of the “substitutions.” No, I did not see this the last time.

I checked the emacs clone with git status, and found nothing in source had changed. I then performed a make clean, followed by a configure, then a ‘make -j 6’ so I could run make against all six cores of the NX. That’s why jtop’s CPU monitor shows all six cores fully utilized. Once finished, make install, and then a quick test. Before this I’d moved over all my emacs configuration files.

emacs 28 running on the Jetson Xavier NX Developer Kit

Not much more to say at this point. I have yet to decide if I’ll build python 3.8.3 like I did on the Nano. I do want to get completely off of Python 2, but I need to better understand the tooling in JetPack before I go off and break stuff.

I will have more to say later about the overall hardware of the NX. Suffice to say it’s a hex core Cortex A75 equivalent, which is, core for core, twice the performance over the Nano’s Cortex A57 cores. It has 8GiB of memory, which makes development much sweeter than on the Nano. And this Developer Kit comes with WiFi and Bluetooth built-in, which makes it much easier to integrate with network and other wireless tools. But as I said, more to come.