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.

executing deno on the jetson xavier nx and jetpack 4.4 dp


If you haven’t noticed lately, there’s an alternative to NodeJS, written by Node’s original creator, named Deno.

Deno was created by Ryan Dahl (along with help from a few special friends), the original creator of NodeJS. Ryan created Deno because, according to him, “I see the bugs that I made, design mistakes made that just cannot be corrected now.” There’s more to his reasons and how he went about solving Node’s problems and limitations in the article “Node.js creator delivers Deno 1.0, a new runtime that fixes ‘design mistakes in Node’“, https://www.theregister.co.uk/2020/05/14/nodejs_creator_deno_10/

I can’t judge whether he’s fixed any, or all, of Node’s problems. But I can judge that his work is very interesting because it’s all implemented in Rust.

To get Deno running I first installed Rust. Then using Rust’s cargo I installed Deno, all on the Jetson Xavier NX running JetPack 4.4, which means Ubuntu 18.04.

Installing Rust is simple enough as documented here: https://www.rust-lang.org/learn/get-started

Or you can copy the following command directly from this post, which was copied from the Rust page, to cut to the chase as it were:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Make sure you ‘apt install curl’ before you do this because curl isn’t installed by default in this version of Ubuntu.

Then go over to the Deno installation section here: https://deno.land/#installation
Or you can simply run the following command once Rust is installed and have Rust just do the heavy lifting:

cargo install deno

You can sit back and watch cargo download and build all the necessary packages to produce a Deno runtime. By the way, Rust is installed in your login directory under ~/.cargo, and that’s where all of Deno is also stashed. It’s local to whatever login account you’re using which makes it kind of handy if you want to delete everything and start over.

With Deno installed I then wrote/copied the tiny test program on the Deno main web page and executed it.

It’s kinda neat. Here is a real strong alternative to Node, written in Rust. It’s a bit over the top to say this, but Deno could be Rust’s “killer project” that really helps push Rust along. If you want a way to dive into Rust, then do it through Deno.

One other thing. I tried to edit TypeScript code in Emacs by attempting to install support via MELPA and MELPA-stable. I’m still the Emacs neophyte after all these years, especially with Emacs Lisp, so that’s a mark against me. But the workaround right now is to name all my files with a .js extension, and then Emacs does its syntax highlighting thing. Problem solved.

I have to admit I’m having fun. I haven’t had this much fun since the “good old days” of the 1970s and early 1980s with the 6502 KIM, Apple ][, and Commodore 64. All those were wide open and very approachable. Today’s Raspberry Pi and Jetson Nano and NX boards bring a lot of that back and make working with both hardware and software so much easier and more powerful.

I’ve got my tools in place, so now it’s time to dig and get a proper feel for the NX and JetPack 4.4.