Setting Up Jetson Nano

[ deep-learning  hardware  embedded  nvidia  jetson  ]

You should refer to Getting Started With Jetson Nano Developer Kit to set up your Jetson Nano from hardware side

Install TensorFlow

Please refer to TensorFlow For Jetson Platform for installing the Tensorflow.

The step is intuitive:

sudo apt-get install libhdf5-serial-dev hdf5-tools
sudo apt-get install python3-pip
pip3 install -U pip
sudo apt-get install zlib1g-dev zip libjpeg8-dev libhdf5-dev 
sudo pip3 install -U numpy grpcio absl-py py-cpuinfo psutil portpicker grpcio six mock requests gast h5py astor termcolor

However, please note there is a bug for pip@19.1 (for more information, please read After pip 10 upgrade on pyenv “ImportError: cannot import name ‘main’”):

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'

To fix it, there are several possbilties:

  • modifiy the pip file: from pip._internal import main
  • try to install a version without this bug: pip install --upgrade pip==9.0.3

Install Jupyter

Perhaps you may not be able to hook a keyboard and monitor to your Jetson all the time, then you could consider to use a Jupyter notebook to control Jetson.

sudo pip3 install ipython jupyter
mkdir ~/.jupyter
touch ~/.jupyter/jupyter_notebook_config.py
jupyter notebook --generate-config ~/.jupyter/jupyter_notebook_config.py

You can set the content of jupyter_notebook_config.py as following:

...
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
## Whether to allow the user to run the notebook as root.
c.NotebookApp.allow_root = True
...

How to Install Jupyter Notebook as Service for Tensor Flow and Deep Learning on Ubuntu 16.04

Then you may want to make the Jupyter to automatically run at each restart of the device. You could do that by making Jupyer as a service:

sudo loginctl enable-linger your_user_name_here
sudo vim /usr/lib/systemd/system/jupyter.service
sudo systemctl enable jupyter.service
sudo systemctl daemon-reload
sudo systemctl restart jupyter.service

Setting up jupyter notebook server as service in Ubuntu 16.04

The content of /usr/lib/systemd/system/jupyter.service is shown below:

[Unit]
Description=Jupyter Notebook

[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/usr/local/bin/jupyter notebook
User=your_user_name_here
Group=your_user_name_here
WorkingDirectory=/home/your_user_name_here/Documents/jupyter
Restart=always
RestartSec=10
#KillMode=mixed

[Install]
WantedBy=multi-user.target

You could verify the Jupyter is running by visiting localhost:8888. If anything is wrong, you could check the error from: journalctl -u jupyter.service

Finally install some packages:

sudo apt-get install libfreetype6-dev libpng-dev
sudo apt-get install graphviz
sudo pip3 install matplotlib
sudo pip3 install pydot graphviz
Written on May 10, 2019