Last active
March 27, 2018 15:14
-
-
Save roebius/991203e11687944f7ffcaec68f5526d4 to your computer and use it in GitHub Desktop.
fastai v2 - bash files for installing the fastai environment on fresh Ubuntu 16.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ./1.install-utils.sh | |
source ./2.install-cuda_8.sh | |
source ./3.install-repos.sh | |
source ./4.install-anaconda-env.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set LC_ALL in /etc/default/locale | |
cp /etc/default/locale . | |
echo "LC_ALL=\"en_US.UTF-8\"" >> locale | |
sudo cp locale /etc/default/locale | |
rm locale | |
# insert here the installation of any optional utility libraries | |
sudo apt --assume-yes install tmux | |
sudo apt --assume-yes install unzip | |
sudo apt --assume-yes install ffmpeg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script assumes that the file cudnn-8.0-linux-x64-v7.tgz is already present in the same directory, | |
# the file can be found at https://developer.nvidia.com/rdp/cudnn-download after registering with Nvidia. | |
# Also it is assumed that the requirements for CUDA 8 installations are already met. | |
# ensure system is updated and has basic build tools | |
sudo apt update | |
sudo apt --assume-yes upgrade | |
sudo apt --assume-yes install build-essential gcc g++ make binutils | |
sudo apt --assume-yes install software-properties-common git | |
# last release of cuda 8 with update | |
wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" -O "cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" | |
sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
sudo apt update | |
sudo apt -y install cuda | |
wget "https://developer.nvidia.com/compute/cuda/8.0/Prod2/patches/2/cuda-repo-ubuntu1604-8-0-local-cublas-performance-update_8.0.61-1_amd64-deb" -O "cuda-repo-ubuntu1604-8-0-local-cublas-performance-update_8.0.61-1_amd64-deb" | |
sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-cublas-performance-update_8.0.61-1_amd64-deb | |
sudo apt update | |
#sudo modprobe nvidia | |
nvidia-smi | |
#rm cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
#rm cuda-repo-ubuntu1604-8-0-local-cublas-performance-update_8.0.61-1_amd64-deb | |
# cudnn | |
echo "installing cudnn ..." | |
tar -zxf cudnn-8.0-linux-x64-v7.tgz | |
sudo cp cuda/lib64/* /usr/local/cuda/lib64/ | |
sudo cp cuda/include/* /usr/local/cuda/include/ | |
#rm cudnn-8.0-linux-x64-v7.tgz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clone the latest fast.ai course repo | |
git clone https://github.com/fastai/fastai.git ~/fastai | |
# download also the pretrained weights files | |
wget http://files.fast.ai/models/weights.tgz | |
tar -xzvf weights.tgz -C ~/fastai/fastai/ | |
#rm weights.tgz | |
# download dogscats for lesson 1 | |
mkdir -p ~/fastai/courses/dl1/data | |
wget http://files.fast.ai/data/dogscats.zip | |
unzip dogscats.zip -d ~/fastai/courses/dl1/data | |
#rm dogscats.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script installs Anaconda for current user, | |
# creates a conda virtual environment named "fast" using the environment.yml file from the fastai repo, | |
# adds the new environment to jupyter notebook kernel list, | |
# adds the nbextensions (optional), | |
# configures jupyter for prompting for password | |
wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh -O ~/anaconda.sh | |
bash ~/anaconda.sh -b -p $HOME/anaconda | |
export PATH="$HOME/anaconda/bin:$PATH" | |
echo "export PATH=\"$HOME/anaconda/bin:\$PATH\"" >> ~/.bashrc | |
# create Anaconda env named "fast" using environment.yml fron fastai repo | |
conda env create --name fast -f ~/fastai/environment.yml | |
source activate fast | |
# add environment to jupyter notebook kernel list | |
python -m ipykernel install --user --name fast --display-name "fast" | |
# add nbextensions | |
conda install -c conda-forge jupyter_contrib_nbextensions | |
# configure jupyter for prompting for password | |
jupyter notebook --generate-config | |
jupass=`python -c "from notebook.auth import passwd; print(passwd())"` | |
echo "c.NotebookApp.password = u'"$jupass"'" >> $HOME/.jupyter/jupyter_notebook_config.py | |
echo "c.NotebookApp.ip = '*' | |
c.NotebookApp.open_browser = False" >> $HOME/.jupyter/jupyter_notebook_config.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bash scripts for installing a fastai v2 work environment on a fresh Ubuntu 16.04 machine
This is a sequence of bash scripts that I have used for installing the fastai environment and fastai v2 repo on a fresh Ubuntu 16.04 machine.
I tested the scripts on both a local machine and on a cloud-based server (an AWS p2.xlarge instance created using the base Ubuntu 16.04 AMI).
The scripts install Nvidia CUDA and CuDNN, download the fastai v2 repo and create an Anaconda environment named "fast" for use with Jupyter Notebook. The optional Jupyter Nbextensions are also installed.
In order to install CuDNN it is assumed that the cudnn file is already available on the target machine in the same folder as the install scripts: direct download of the cudnn files is restricted to registered Nvidia website users.
HOW TO INSTALL AND USE THE ENVIRONMENT
INSTALLATION
(chmod +x *.sh)
0.fastai-env-install.sh
script which in turn will run all the other scripts; when prompted pick always the default choicessource ~/.bashrc
: this will set the required path variablesUSAGE
cd ~/fastai/courses/dl1
source activate fast
jupyter notebook