Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Installing PyTorch, torchvision, spaCy, torchtext on Jetson Nanon [ARM]
# This script will install pytorch, torchvision, torchtext and spacy on nano.
# If you have any of these installed already on your machine, you can skip those.
# Tailored for virtual environments created with python3 -m venv [name]
if [ -z ${VIRTUAL_ENV+x} ]
echo "Not in a virtual environment"
exit 1
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get install python3-setuptools
#Installing PyTorch
#For latest PyTorch refer original Nvidia Jetson Nano thread -
wget -O torch-1.6.0rc2-cp36-cp36m-linux_aarch64.whl
sudo apt-get install libopenblas-base
$PIP_PATH install Cython
$PIP_PATH install numpy torch-1.6.0rc2-cp36-cp36m-linux_aarch64.whl
#Installing torchvision
#For latest torchvision refer original Nvidia Jetson Nano thread -
sudo apt-get install libjpeg-dev zlib1g-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch v0.7.0-rc2 torchvision # see below for version of torchvision to download
cd torchvision
sudo $PYTHON_PATH install
cd ../ # attempting to load torchvision from build dir will result in import error
#Installing spaCy
#Installing dependency sentencepiece
sudo apt-get install cmake build-essential pkg-config libgoogle-perftools-dev
git clone
cd sentencepiece
mkdir build
cd build
cmake ..
make -j $(nproc)
sudo make install
sudo ldconfig -v
cd ../python
sudo $PYTHON_PATH install
cd ../../
git clone
cd spaCy/
export PYTHONPATH=`pwd`
export BLIS_ARCH=generic
$PIP_PATH install -r requirements.txt
sudo $PYTHON_PATH build_ext --inplace
sudo $PYTHON_PATH install
$PYTHON_PATH -m spacy download en_core_web_sm
cd ../
#Installing torchtext
git clone torchtext
cd torchtext
git submodule update --init --recursive
$PYTHON_PATH clean install
cd ../
echo "done installing PyTorch, torchvision, spaCy, torchtext"
Copy link

Nolence commented Aug 23, 2020

Thanks for the script! Very useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment