Julia Language Logo

How to Install TensorFlow & Julia on a Jetson Nano

A few months ago I bought a Jetson Nano as a Christmas present for myself. I promptly got busy with work and life and forgot to set up until a month ago. I followed the instructions on how to flash the unit and got Ubuntu 18 up and running. That was the easy part, it was when I wanted to install Julia, TensorFlow, and Python that it got less easy.

My goal was to use TensorFlow, Julia, and Python3 to build all kinds of GPU-enabled projects. I plan on hacking this stuff together over time but I ended up spending one evening weeding through too many different tutorials and Stackoverflow threads than I care to count. Below is a short and easy set of steps that I used to install them.

Installing Julia Language

DO NOT install the binaries if you want to install Julia Language on the Jetson Nano. You are better off compiling from source. This took me several trials with several errors to figure this out because I was lazy. I wanted to just grab the binaries and be done with it. I also learned the hard way that if you download the binaries you get the latest released version. This could present problems with some packages NOT working because they haven’t caught up to the latest Julia. As of the writing of this article, the current Julia version is 1.4.0. I opted to get the 1.3.0 version and so far so good.

I went to Julia Language Github site, did a ‘git clone git://github.com/JuliaLang/julia.git’ into a $HOME/julia directory, and then did a ‘git checkout v1.3.0’ to get the version I wanted.

$ mkdir julia
$ cd julia
$ ~/julia git clone git://github.com/JuliaLang/julia.git
$ ~/julia git checkout v1.3.0
$ ~/julia make

After that, it was a simple ‘make’ and then I wanted for about an hour. I did run ‘make testall’ to check if everything was installed correctly and it took several hours to run. It did not complete because I canceled it after 2 hours. I know, I’m living dangerously here.

$ ~/julia make testall

Why Julia?

Honestly, I had problems installing TensorFlow on the first go around and wanted to use the TensorFlow.jl package. Once again, I was being lazy. This turned out to be a problem and I haven’t figured out what the reason is. I suspect why it’s not working has to do with Jetpack, Julia, and TensorFlow.jl versions. Bummer.

However, all is not lost with using the Nano’s GPU. There are other great libraries for Julia called CUDANative.jl. I discovered this library (and others) via NVIDIA’s Dev blog here. I used the first example in the blog post in Julia and got the GPU to respond. While I might not be able to use TensorFlow with Julia just yet, this is a good thing as it will allow me to explore GPUs on the Nano my Julia install.

Python3 and TensorFlow

I originally installed Python3 a while back on the Nano and then tried to install TensorFlow by doing a ‘sudo pip3 install TensorFlow‘. This did not work for me as I was missing several dependencies. It wasn’t until I found this blog post on Deeplearning Frameworks from NVIDIA that led to a successful TensorFlow install. Now I have it up and running and training a simple LSTM hAIku generator as a test. So far so good.

Other Tips to Avoid Hair Loss

The Jetson Nano’s onboard memory is really small, only 4GB. Normally this should be ok but there are times when you’re setting up your deep learning experiment where it will cause an Out Of Memory (OOM) error. I’ve had to make my sequence lengths smaller when using the LSTM model so that it could fit into the onboard memory.

Trying to work around this led me to try resizing my swap file. By default, the Nano flashes about 2GB of swap size. I decided to double that to 4GB by using the ‘resizeSwapMemory‘ python package. This helped initially but I kept getting OOM errors until I changed the sequence length.

Another useful item is Jtop. Jtop is just a CPU and GPU monitor that I use when I’m running an experiment on the Nano.

End Notes

If you have any questions or figured out how to use TensorFlow.jl, please drop me a comment or reach out to me on Twitter. Good luck!

Update in 2021

I recently upgraded the version of TensorFlow on the Nano to version 2.3.1. At first, I was seduced by just downloading the WHL file for it and when I installed it, it didn’t find my GPU. So I had to compile everything from scratch. After that, it worked.

However, it took 56 hours. Yes! 56. Freaking. Hours.

Then it worked perfectly. So if you want to do it, just follow the “From Scratch” instructions here.

Hey! Get on Our Newsletter!

Subscribe to our newsletter and never miss a beat! Thank you so much!

Learning Python Programming the Easy Way

I picked up python programming when I needed to do something but couldn’t figure out how to connect the dots. Luckily there were some great books out there that I picked up and helped accelerate my learning process. Affiliate links are below:



, ,



One response to “How to Install TensorFlow & Julia on a Jetson Nano”

  1. […] TinyML seeks to bring the power of deep learning to small microcontrollers and chips are cheap to produce, use low power, and can run on a battery. I really like this idea since I have several Raspberry Pi computers and a Jetson Nano. […]

Leave a Reply

Your email address will not be published. Required fields are marked *