Skip to main content

Install Pytorch for reComputer Jetson

This wiki demonstrates how to install NVIDIA-optimized PyTorch on your reComputer, matching your JetPack version. It also covers how to use virtual environments (conda) to manage multiple PyTorch versions for development and deployment.

Prerequisites

  • reComputer with JetPack installed
  • Internet connection

Install PyTorch for reComputer

Here, we will introduce how to install PyTorch with CUDA support in the two commonly used versions of Jetpack 5 and Jetpack 6.

In reComputer, the commonly used version of Jetpack 5 is 5.1.3. Here, we will use it to introduce how to install PyTorch.

Step 1. Update system and install dependencies:

sudo apt-get -y update
sudo apt-get install -y python3-pip libopenblas-dev

Step 2. Download the official PyTorch wheel (example: torch-2.1.0 for JetPack 5.1.3, Python 3.8):

wget https://developer.download.nvidia.com/compute/redist/jp/v512/pytorch/torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl
pip install torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl
note

If you need a more recent version of torch that supports Jetpack 5.1.3, please download the compiled wheel file from here (torch-2.2 for python3.8).

Step 3. Verify installation:

import torch
print(torch.cuda.is_available())
print(torch.__version__)

Multiple PyTorch Versions with Conda

Miniconda is a lightweight installer for the Conda package manager, providing a minimal environment to quickly create and manage Python environments and packages.

Step 1. Install Miniconda:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh
bash Miniconda3-latest-Linux-aarch64.sh
info
  • Follow the instructions and enter "yes" to agree to the terms.
  • The installation path is recommended to use the default setting, such as ~/miniconda3.
  • Finally, it prompts whether to automatically add to .bashrc. It is recommended to enter "yes".

Step 2. Initialize and configure conda:

source ~/.bashrc
# Verify if conda is functioning properly
conda --version
# Disable automatic entry into the conda base environment
conda config --set auto_activate_base false
# Close and reopen the terminal. By default, it will not enter the base environment.

Step 3. Create a new environment and install a specific PyTorch wheel:

conda create -n torch_2.0 python=3.8
conda activate torch_2.0

Step 4. Download and install the PyTorch wheel file as shown in the previous sections.

info

For more details, see the NVIDIA PyTorch installation guide

Resources

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...