Install fastAI on Computer (Linux)

June 27, 2022

Materials

Install

Install via WSL

to be updated

Install via Virtual Machine

to be updated

Install Linux (Ubuntu)

  1. Format the hard-drive (optional)
  2. Download latest Bios
  3. Create a system image backup [look into this] => might want to avoid this entirely and just creating a VM
  4. format your flash drive
  5. download and install Balena etcher
  6. download and install Ubuntu 20.4 LTS (or whatever version is available)
  7. flash Ubunto ISO onto flashdrive
  8. Do shrink volume and create a partition for Ubuntu (at least 20 Gb)
  1. get into bootloader (by restarting and spamming F12, F2, F1, etc.)
  2. Ensure a few settings on your computer:
    • AHCI is enabled
    • Secure Boot enabled
  3. blah blah blah install ubuntu according to savvy nick tutorial

Install NVIDIA Drivers

  1. open terminal on ubuntu:
sudo apt-get update
sudo apt-get upgrade
  1. Check to see which NVIDIA drivers to install
    1. type in terminal https://linuxize.com/post/how-to-nvidia-drivers-on-ubuntu-20-04/:

    ubuntu-drivers devices

    1. I got something that looked like this in return: [insert screenshot]
    2. Install the recommended driver, in my case I typed into terminal: sudo apt install nvidia-driver-510
    3. Once installed reboot system: sudo reboot
  2. Install Nvidia drivers: (MAKE SURE YOUR TERMINAL IS FULL SCREEN WHEN DOING THIS)
  3. Check Nvidia drivers with nvidia-smi https://forums.fast.ai/t/platform-local-server-ubuntu/65851
  4. sudo add-apt-repository ppa:graphics-drivers/ppa https://phoenixnap.com/kb/install-nvidia-drivers-ubuntu
  5. ubuntu-drivers devices https://phoenixnap.com/kb/install-nvidia-drivers-ubuntu
  6. sudo ubuntu-drivers autoinstall (alternatively, you could install an individual driver by replacing autoinstall with the specific driver name, but eh)
  7. while the drivers are installing, you should get a window that pops up that asks for MOK authentication – for secure boot
  8. click okay
  9. create a password
  10. sudo reboot
  11. follow this: https://documentation.commvault.com/commvault/v11/article?p=118661.htm
  12. open up terminal again and verify the drivers are there with nvidia-smi

Install miniconda

  1. download miniconda for linux from website
  2. navigate to downloads folder using ls and cd
  3. chmod +x [name of miniconda file]
  4. ./[name of miniconda file]
  5. press space and enter and yes a few times
  6. close terminal and open up a new one and type in conda to see if works

Install fastAI

This also helped me avoid bugs with running widgets in jupyter notebook:

sudo apt install nodejs
sudo apt install npm
sudo apt install git
  1. create fastbook
mkdir repos #(folder can be named anything)
cd repos
git clone https://github.com/fastai/fastbook
cd fastbook
conda env create -f environment.yml
conda activate fastbook
pip install fastbook
  1. open a new terminal for and type jupyter-lab
  2. navigate to clean and first notebook
  3. monitoring GPU and CPU usage and temps: [GPU should be at or near 100% when running epocs, but shouldn’t exceed 85C <= cooling needed if this occurs] In a new terminal type in watch -d -n 0.5 nvidia-smi https://unix.stackexchange.com/questions/38560/gpu-usage-monitoring-cuda
  4. open up system info to look at CPU cores
  5. Run first 3 things in Jupyter

You’re good to go now. Note: if your system takes x seconds to run this, you probably need a new computer

Troubleshooting

Problem:

(base) username:~$ nvidia-smi
Failed to initialize NVML: Driver/library version mismatch

Solution: ^ you probably need to install one of the nvidia drivers (see Install NVIDIA Drivers).

Problem: If you get something like this:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.

Solution: The following information may help to resolve the situation:

The following packages have unmet dependencies:
nvidia-driver-470 : Depends: nvidia-kernel-source-470 (= 470.103.01-0ubuntu0.20.04.1) but it is not going to be installed
Depends: libnvidia-extra-470 (= 470.103.01-0ubuntu0.20.04.1) but it is not going to be installed
Recommends: libnvidia-ifr1-470:i386 (= 470.103.01-0ubuntu0.20.04.1)
Recommends: libnvidia-gl-470:i386 (= 470.103.01-0ubuntu0.20.04.1)
E: Unable to correct problems, you have held broken packages.

Try this: https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa Or try this: https://askubuntu.com/questions/1362970/problem-installing-nvidia-driver-on-ubuntu-20-04