Installing CodeProject.AI Server on a Jetson Nano as a Development environment
The Jetson Nano is a popular dev board that comes in 2GB and 4GB sizes. This makes it a challenge to work with, but the onboard GPU does make the effort worthwhile.
While NVIDIA provides images for the Nano, these images are based on Ubuntu 18.04 which can cause issues due to its age. We support the QEngineering Jetson Nano images that come with Ubuntu 20.04, as well as PyTorch, Tensorflow, TensorRT and OpenCV pre-installed.
While the QEngineering image will cause more stress on a tiny system, the ease of use outweighs this.
To setup your Jetson Nano for CodeProject.AI Server
-
Create a boot SD card by downloading balena Etcher and the QEngineering Ubuntu 20.04 Image. We recommend this in preference to the Official Jetson Nano image due to the QEngineering image being a more updated distro, as well as it being chock-full of all the AI pieces you need such as Tensorflow, PyTorch, TensorRT and OpenCV.
-
Setup your Nano by inserting the card into the device, plugging in keyboard, mouse, monitor and power, and following the instructions. After a restart you'll find yourself on the Jetson Nano desktop
-
Increase your swap size by downloading the
setSwapMemorySize.sh
script. The script will arrive in~/Downloads
. Open a terminal and run the following.Reboot your Jetson to allow the changes to take effect.
-
Download VSCode using the Mozilla browser (don't download Chrome on the QEngineering image because it will mess with snapd) and head to code.visualstudio.com/download. Download the arm64 debian package. The Visual Studio Code installer will be in saved to
~/Downloads
-
To install Visual Studio Code open a terminal window and call
code_1.85.1-102461056_arm64.deb
is the latest filename, but this will change. Use the name of the .deb file you downloaded from Microsoft. -
Open VSCode, sign in, and sync your VSCode settings (the 'head' icon at the bottom left of the VSCode window). A browser window will pop up to allow you to authenticate: always close this after authentication to reduce memory pressure. The syncing of settings may take some time depending on how many extensions you have. The Jetson itself may become unresponsive during this due to lack of memory. Let it run - it could be half an hour to an hour.
Your Nano may lockup and VSCode may crash. Multiple times. Just keep trying. Eventually you will have VS Code setup and synced.
-
Clone the CodeProject.AI project from GitHub (using the Git tools in VSCode is easiest) and then open the project. Again: the GitHub auth will launch Chrome and you may run out of memory and see lockups and crashes. Persist.
-
Setup the dev environment on the Nano by heading to
src
in the project and running ```bash bash setup.sh ```` You will need to provide an admin password at various points in the process. The entire setup will take over an hour. -
Build and run in VSCode using the debug tab. Choose 'Build all and Launch server (arm64)'. Note that this will build and run CodeProject.AI on the Jetson using the full VSCode editor, the .NET runtime, and Python, while also opening a Chrome browser. Your Jetson Nano will be stressed to the limit.
-
Alternative option: SSH to the Jetson Using SSH to connect to the Jetson Nano allows you to have a smooth and seamless editing, build and debug experience on the Jetson without placing undue memory and processing pressure on the device from VSCode. If the device locks up you can still edit, and sometimes even save changes, while the device works through its issues.
You can SSH from another machine into the Jetson Nano using the VSCode Remote SSH extension. Install this on your main desktop, go to the Dev Containers tab on your desktop, enter the IP address of your Jetson (use
ifconfig
on the Jetson to find your address) and then follow the prompts to login.The 'Open Folder' menu option allows you to then open the folder containing the cloned CodeProject.AI solution, and from then on you are editing, building and debugging on the Jetson, but using the power of your desktop to take the editing and GUI load off the Nano.
As in step 9, simply choose 'Build all and Launch server (arm64)' to build on the Jetson, and then launch the server and dashboard for the Jetson.