Jetson Nano Python 3.8

Hello,

I’m trying to run YOLOv8 on my Jetson Nano 2 GB, but I’m running into Python version issues since the Nano only comes with Python 3.6 by default. To fix this, would I need to build Python 3.8 from source? If so, would the following commands work?

sudo apt update
sudo apt install -y build-essential checkinstall
sudo apt install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev \
    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

cd /tmp
wget https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tgz
tar xzf Python-3.8.18.tgz
cd Python-3.8.18

./configure --enable-optimizations --with-ensurepip=install
make -j4
sudo make altinstall

And then would I follow these directions for getting a compatible version of PyTorch?

Thank you!

Hello @xiaokangxu2,

Have you already evaluated the option of using a Docker container ?

best regards,
Andrew
Embedded Software Engineer at ProventusNova

Hello,

Thank you for the suggestion. I had not, but I have already built Python 3.8 from source, so I’ll just stick with this. However, it seems that to use PyTorch (1.10), you need to build from source also because NVIDIA doesn’t have any prebuilt versions with 3.8. I’m assuming this will take many hours on the Jetson Nano 2 GB version. Would you happen to know if there are versions compatible with 3.8 publicly available or if there is some way to circumvent this?

Thank you very much!

Hey @xiaokangxu2,

Sounds good!
Glad to hear you managed to get Python3.8 working.

To answer your question.
I am not aware of any pre-built PyTorch that could work in that case.
However, one trick I always use when I need to build heavy stuff for our projects is to use an online arm64 computer, like an EC2 instance or similar. As long as it is an arm64 machine and it matches the libraries on your Jetson, you should be able to build there and use the binaries on your embedded.

Let us know if you have any other questions or require further support.
Would love to help.

best regards,
Andrew
Embedded Software Engineer at ProventusNova

Thank you for the suggestions! I will try to do it on the Nano first, but I think it would be good to have a backup method. Would you be able to elaborate a little more on using an online ARM64 computer? Thank you!

Hello,

I have managed to create an Oracle ARM VM with Ubuntu 20.04 image, but how do I make sure that the environment matches that of the Jetson?

Thank you!

Hello @xiaokangxu2 ,

Sorry for the late reply.
Yesterday I was away from my computer for the most part of the day.

Great to hear you now have an ARM VM running !

The steps we would follow in your position would be to:

  1. Make sure you are using the Same Ubuntu version that comes with the Jetpack version you have on your NVIDIA Jetson board.

  2. Clone the PyTorch repo you need to build and check its requirements and dependencies.

  3. Make sure to install the same version of dependencies you have on your Jetson board.

  4. Try building. Chances are that PyTorch will let you know if you are missing something. If so, then you just check what version of that dependency you have on your Jetson and you install that on the VM.

  5. Repeat step 4 until you have a successful build.

  6. Export the built libraries so you can later install on your Jetson. We suggest you package it all up on a debian package for easy install later.

  7. Try installing and testing the library on your Jetson board.

  8. Try using the library, see if it works.

Please let us know if you encounter any issues.

best regards,

Andrew
Embedded Software Engineer at ProventusNova

Apologies for the late response. I actually managed to build directly on the Nano within a reasonable time frame, but thank you for the help!

Hello @xiaokangxu2,

That sounds great!
Glad to hear you are past that now.

Don’t hesitate to reach out if you further support, we would love to help.

best regards,

Andrew

Embedded Software Engineer at ProventusNova