Skip to content

Instantly share code, notes, and snippets.

@wontheone1
Last active October 6, 2018 15:35
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 wontheone1/9fedace1bea14cd494748ef2b936f77c to your computer and use it in GitHub Desktop.
Save wontheone1/9fedace1bea14cd494748ef2b936f77c to your computer and use it in GitHub Desktop.
Fastai setup script for GCP compute engine
#! /bin/bash
DEBIAN_FRONTEND=noninteractive
sudo apt update
mkdir downloads
cd downloads
# INSTALL ANACONDA 5.3.0
ANACONDA=Anaconda3-5.3.0-Linux-x86_64.sh
wget https://repo.continuum.io/archive/$ANACONDA
bash $ANACONDA -b
rm $ANACONDA
cd
git clone https://github.com/fastai/fastai.git
cd fastai/
# following is for all users comment it and uncomment the next line if you want to add conda for only you
sudo ln -s /home/$USER/anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
# echo ". /home/$USER/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
echo 'export PATH=~/anaconda3/bin:$PATH' >> ~/.bashrc
export PATH=~/anaconda3/bin:$PATH
source ~/.bashrc
conda env update
echo 'source activate fastai' >> ~/.bashrc
source activate fastai
source ~/.bashrc
# Note book works at this point
cd ..
sudo apt install unzip -y
sudo apt -y upgrade --force-yes # --force-yes is deprecated
sudo apt -y autoremove
jupyter notebook --generate-config
echo "c.NotebookApp.ip = '*'" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.open_browser = False" >> ~/.jupyter/jupyter_notebook_config.py
sudo ufw allow 8888/tcp
sudo apt -y install qtdeclarative5-dev qml-module-qtquick-controls
sudo add-apt-repository ppa:graphics-drivers/ppa -y
sudo apt update
# Targeting ubuntu1604
cd ~/downloads/
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt update
sudo apt install cuda -y
wget http://files.fast.ai/files/cudnn-9.1-linux-x64-v7.tgz
tar xf cudnn-9.1-linux-x64-v7.tgz
sudo cp cuda/include/*.* /usr/local/cuda/include/
sudo cp cuda/lib64/*.* /usr/local/cuda/lib64/
pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension --sys-prefix
pip install --upgrade pip
# Kaggle cli
pip install kaggle
# Symlink from data folder to
# uncomment to reboot
# sudo reboot
@wontheone1
Copy link
Author

wontheone1 commented Oct 5, 2018

https://raw.githubusercontent.com/howkhang/fastai-v2-setup/master/setup.sh

#! /bin/bash

DEBIAN_FRONTEND=noninteractive

sudo rm /etc/apt/apt.conf.d/*.*
sudo apt update
mkdir downloads
cd downloads
wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh
bash Anaconda3-5.0.1-Linux-x86_64.sh -b
cd
git clone https://github.com/fastai/fastai.git
cd fastai/
echo 'export PATH=~/anaconda3/bin:$PATH' >> ~/.bashrc
export PATH=~/anaconda3/bin:$PATH
source ~/.bashrc
conda env update
echo 'source activate fastai' >> ~/.bashrc
source activate fastai
source ~/.bashrc
cd ..
mkdir data
cd data
wget http://files.fast.ai/data/dogscats.zip
sudo apt install unzip -y
sudo apt -y upgrade --force-yes
sudo apt -y autoremove
unzip -q dogscats.zip
cd ../fastai/courses/dl1/
ln -s ~/data ./
jupyter notebook --generate-config
echo "c.NotebookApp.ip = '*'" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.open_browser = False" >> ~/.jupyter/jupyter_notebook_config.py
sudo ufw allow 8888/tcp
sudo apt -y install qtdeclarative5-dev qml-module-qtquick-controls
sudo add-apt-repository ppa:graphics-drivers/ppa -y
sudo apt update
cd ~/downloads/
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt update
sudo apt install cuda -y
wget http://files.fast.ai/files/cudnn-9.1-linux-x64-v7.tgz
tar xf cudnn-9.1-linux-x64-v7.tgz
sudo cp cuda/include/*.* /usr/local/cuda/include/
sudo cp cuda/lib64/*.* /usr/local/cuda/lib64/
pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension --sys-prefix
sudo reboot

@wontheone1
Copy link
Author

@wontheone1
Copy link
Author

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