Setup ubuntu box with fastai

list of actions to get a fastai workstation ready
fastai
cuda
linux
Published

September 23, 2020

Install miniconda

Get miniconda Linux installer.

Check sha256sum: sha256sum Miniconda3-latest-Linux-x86_64.sh

Run install: ./Miniconda3-latest-Linux-x86_64.sh -p $HOME/miniconda3

Install fastai

conda create -n fastai python=3.8
conda activate fastai
conda install -c fastai -c pytorch fastai

Install jupyter within fastai environment

conda activate fastai
conda install jupyter

Test fastai installation (valid for v1)

With fastai v1, there was an easy way to check installation:

conda activate fastai
python -m fastai.utils.show_install

get git repo to learn from fastai

From git folder,

git clone https://github.com/fastai/fastai

Test fastai v2 installation

From python environment:

from fastai.vision.all import *

From jupyter notebook

from fastai.vision.all import *

Install nvidia drivers for ubuntu

I tried by downloading a driver from nvidia website. But I was unable to install it (nvidia-drm-drv.c:662:44: error: 'DRIVER_PRIME' undeclared here (not in a function); did you mean 'DRIVER_PCI_DMA'?)

sudo ubuntu-drivers autoinstall

then rebooting fixed the issue.

Run courses from fastai github repo

just run fastai/dev_nbs/course/lesson1-pets.ipynb

And everything is just fined ;)

install nbdev

This is for rendering reasons: To get a prettier result with hyperlinks to source code and documentation, install nbdev: pip install nbdev

!pip install nbdev
Collecting nbdev
  Downloading nbdev-1.0.18-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 1.5 MB/s eta 0:00:01
Requirement already satisfied: fastcore>=1.0.5 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbdev) (1.0.13)
Requirement already satisfied: packaging in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbdev) (20.4)
Requirement already satisfied: jupyter-client in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbdev) (6.1.6)
Requirement already satisfied: nbconvert<6 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbdev) (5.6.1)
Requirement already satisfied: nbformat>=4.4.0 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbdev) (5.0.7)
Collecting fastscript>=1.0.0
  Downloading fastscript-1.0.0-py3-none-any.whl (11 kB)
Requirement already satisfied: pyyaml in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbdev) (5.3.1)
Requirement already satisfied: pip in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbdev) (20.2.2)
Requirement already satisfied: ipykernel in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbdev) (5.3.4)
Requirement already satisfied: pyparsing>=2.0.2 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from packaging->nbdev) (2.4.7)
Requirement already satisfied: six in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from packaging->nbdev) (1.15.0)
Requirement already satisfied: pyzmq>=13 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jupyter-client->nbdev) (19.0.2)
Requirement already satisfied: tornado>=4.1 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jupyter-client->nbdev) (6.0.4)
Requirement already satisfied: python-dateutil>=2.1 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jupyter-client->nbdev) (2.8.1)
Requirement already satisfied: traitlets in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jupyter-client->nbdev) (4.3.3)
Requirement already satisfied: jupyter-core>=4.6.0 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jupyter-client->nbdev) (4.6.3)
Requirement already satisfied: pandocfilters>=1.4.1 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbconvert<6->nbdev) (1.4.2)
Requirement already satisfied: pygments in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbconvert<6->nbdev) (2.7.1)
Requirement already satisfied: mistune<2,>=0.8.1 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbconvert<6->nbdev) (0.8.4)
Requirement already satisfied: defusedxml in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbconvert<6->nbdev) (0.6.0)
Requirement already satisfied: bleach in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbconvert<6->nbdev) (3.2.1)
Requirement already satisfied: jinja2>=2.4 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbconvert<6->nbdev) (2.11.2)
Requirement already satisfied: testpath in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbconvert<6->nbdev) (0.4.4)
Requirement already satisfied: entrypoints>=0.2.2 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbconvert<6->nbdev) (0.3)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbformat>=4.4.0->nbdev) (3.0.2)
Requirement already satisfied: ipython-genutils in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from nbformat>=4.4.0->nbdev) (0.2.0)
Requirement already satisfied: ipython>=5.0.0 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from ipykernel->nbdev) (7.18.1)
Requirement already satisfied: decorator in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from traitlets->jupyter-client->nbdev) (4.4.2)
Requirement already satisfied: webencodings in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from bleach->nbconvert<6->nbdev) (0.5.1)
Requirement already satisfied: MarkupSafe>=0.23 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jinja2>=2.4->nbconvert<6->nbdev) (1.1.1)
Requirement already satisfied: pyrsistent>=0.14.0 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.4.0->nbdev) (0.17.3)
Requirement already satisfied: attrs>=17.4.0 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.4.0->nbdev) (20.2.0)
Requirement already satisfied: setuptools in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.4.0->nbdev) (49.6.0.post20200814)
Requirement already satisfied: backcall in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from ipython>=5.0.0->ipykernel->nbdev) (0.2.0)
Requirement already satisfied: pexpect>4.3; sys_platform != "win32" in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from ipython>=5.0.0->ipykernel->nbdev) (4.8.0)
Requirement already satisfied: pickleshare in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from ipython>=5.0.0->ipykernel->nbdev) (0.7.5)
Requirement already satisfied: jedi>=0.10 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from ipython>=5.0.0->ipykernel->nbdev) (0.17.2)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from ipython>=5.0.0->ipykernel->nbdev) (3.0.7)
Requirement already satisfied: ptyprocess>=0.5 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from pexpect>4.3; sys_platform != "win32"->ipython>=5.0.0->ipykernel->nbdev) (0.6.0)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from jedi>=0.10->ipython>=5.0.0->ipykernel->nbdev) (0.7.0)
Requirement already satisfied: wcwidth in /home/explore/miniconda3/envs/fastai/lib/python3.8/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.0.0->ipykernel->nbdev) (0.2.5)
Installing collected packages: fastscript, nbdev
Successfully installed fastscript-1.0.0 nbdev-1.0.18