Skip to content

Instantly share code, notes, and snippets.

@traoremp
Last active March 12, 2020 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save traoremp/bc2f9c1118aafd0029534c016d763ccd to your computer and use it in GitHub Desktop.
Save traoremp/bc2f9c1118aafd0029534c016d763ccd to your computer and use it in GitHub Desktop.
Download and install pytorch from source
#!/bin/sh
cd ~
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
# if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive
# download conda
wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh
chmod +x Anaconda3-2020.02-Linux-x86_64.sh
./Anaconda3-2020.02-Linux-x86_64.sh
eval "$(/home/traoremp/anaconda3/bin/conda shell.YOUR_SHELL_NAME hook)"
# install gg-7 (because for some reason we cannot build with versions > 8)
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 -y
# will undo at the end of script
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-7
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
python setup.py install
sudo update-alternatives --remove-all gcc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment