Install fast.ai with Ubuntu 18.04

James Dietle
Sep 5 · 3 min read

Although I have been diving more into containers and cloud services. I am always a big fan of building my own machines. Primarily because it forces me to unceremoniously fight through dependency hell.

It’s good for you. (Also, building your own machine makes it feel like its a part of you.)

Since I needed notes for next time, I decided to just have an article that I can update.

Steps

  1. Install Ubuntu 18.04

When selecting a computer, there are several fantastic articles you can look at. Here, here, or here.

2. Optional Install ssh

I run my servers headless. This allows me to log in while on the road, at coffee shops, and all over my house. Even if you need to have a monitor I recommend setting up ssh for your home machine.

However, I need to make sure I set-up securely with certificates and not with passwords.

3. Added Dependencies

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install freeglut3 freeglut3-dev libxi-dev libxmu-dev

4. Install Cuda

I am currently installing the 10.1 because I am running into problems with other versions. You need to download from there.

Then following their instructions.

sudo dpkg -i cuda-repo-ubuntu1804–10–0-local-10.0.130–410.48_1.0–1_amd64.deb
sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
sudo reboot now

5. Check if GPUs are viewable

nvidia-smi

You should see this but with your graphics cards.

6. Install Conda

wget https://repo.anaconda.com/archive/Anaconda3-5.0.1-Linux-x86_64.sh
bash Anaconda3-5.0.1-Linux-x86_64.sh
source ~/.bashrc

7. Install Fast.ai

conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
conda install -c pytorch -c fastai fastai
sudo apt-get install ubuntu-drivers-common

8. Install fast.ai

git clone https://github.com/fastai/fastai
cd fastai
tools/run-after-git-clone
pip install -e ".[dev]"

9. Jupyter

Put in a fancy password for your jupyter notebook

jupyter notebook --generate-config
jupyter notebook password

10. Go check out an example

nohup ignores the output signal so you can close the window. Here I am running a jupyter notebook without a browser on port 8889. (Because 8888 is another machine.

nohup jupyter notebook — no-browser — port=8889

Then go to an example.

http://localhost:8889/notebooks/fastai/examples/dogs_cats.ipynb

Add a stock photo to show completion.

Optional items that might make things go faster:

conda uninstall --force jpeg libtiff -y
conda install -c conda-forge libjpeg-turbo
CC="cc -mavx2" pip install --no-cache-dir -U --force-reinstall --no-binary :all: --compile pillow-simd

References:

James Dietle

Written by

Afflicted with technical wanderlust. Father, Hacker, Veteran, HBS Alumni, @Fastai student

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade