Skip to content

Instantly share code, notes, and snippets.

@nlinker
Forked from dusty-nv/pytorch_jetson_install.sh
Created October 26, 2018 06:23
Show Gist options
  • Save nlinker/35191f8d0bf0a4d09eaa2abc2c5a33e6 to your computer and use it in GitHub Desktop.
Save nlinker/35191f8d0bf0a4d09eaa2abc2c5a33e6 to your computer and use it in GitHub Desktop.
Install procedure for pyTorch on NVIDIA Jetson TX1/TX2
#!/bin/bash
#
# pyTorch install script for NVIDIA Jetson TX1/TX2,
# from a fresh flashing of JetPack 2.3.1 / JetPack 3.0 / JetPack 3.1
#
# for the full source, see jetson-reinforcement repo:
# https://github.com/dusty-nv/jetson-reinforcement/blob/master/CMakePreBuild.sh
#
# note: pyTorch documentation calls for use of Anaconda,
# however Anaconda isn't available for aarch64.
# Instead, we install directly from source using setup.py
sudo apt-get install python-pip
# upgrade pip
pip install -U pip
pip --version
# pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7)
# clone pyTorch repo
git clone http://github.com/pytorch/pytorch
cd pytorch
git submodule update --init
# install prereqs
sudo pip install -U setuptools
sudo pip install -r requirements.txt
# Develop Mode:
python setup.py build_deps
sudo python setup.py develop
# Install Mode: (substitute for Develop Mode commands)
#sudo python setup.py install
# Verify CUDA (from python interactive terminal)
# import torch
# print(torch.__version__)
# print(torch.cuda.is_available())
# a = torch.cuda.FloatTensor(2)
# print(a)
# b = torch.randn(2).cuda()
# print(b)
# c = a + b
# print(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment