Local Linux Setup (with tmux/p and anaconda)

(WG) #1

For those of you wanting to run the v3 course notebooks on your own DL rig, here are the steps I followed to get things working …

I LOVE tmux and tmuxp and highly recommend both as a mean to get you up and running quickly.


  1. Clone the course repo:
mkdir -p ~/development/_training/ml/fastai-courses
cd ~/development/_training/ml/fastai-courses
git clone https://github.com/fastai/course-v3.git
  1. Create a conda environment:
conda create --name fastai-course-v3 python=3.7
  1. Create a tmuxp .yml file to configure your environment (see here for more on tmuxp)
touch ~/.tmuxp/fastai-course-v3.yml 
vim ~/.tmuxp/fastai-course-v3.yml 
session_name: fastai-course-v3
- window_name: dev window
  layout: main-vertical
    main-pane-width: 140
    # run as a first command in all panes
    - cd ~/development/_training/ml/fastai-courses/course-v3
    - source activate fastai-course-v3
    - shell_command:
      - clear
    - shell_command:
      - clear
      - jupyter notebook
    - shell_command:
      - watch -n 0.5 nvidia-smi
  1. Load the tmux environment you just defined:
tmuxp load fastai-course-v3

Here is what my screen looks like …

  1. With your fastai-course-v3 environment activate, install the bit you’ll need as descibed on the fastai readme:
conda install -c pytorch pytorch-nightly cuda92
conda install -c fastai torchvision-nightly
conda install -c fastai fastai

# you may want to include the jupyter extensions to get things like code folding
conda install -c conda-forge jupyter_contrib_nbextensions   


At this point you should be able to run your jupyter notebook by going to localhost:8888 or whatever port you have it running on.

If you get any errors when running jupyter, you may need to update your ~/.jupyter/jupyter_notebook_config.py, changing …
c.NotebookApp.ip = '*'
c.NotebookApp.ip = ''

Run the following every time before you start working with the course material. They ensure you got the latest course code, latest production build of fastai, and that latest pytorch 1.0 builds:

cd ~/development/_training/ml/fastai-courses/course-v3
git pull

conda update -c pytorch pytorch-nightly cuda92      
conda update -c fastai torchvision-nightly      
conda update -c fastai fastai 

This thread has a bunch of helpful information as well.

SoCAL Group for Part-1 V3 lessons
(William Horton) #2

I’ve used tmux to run my jupyter notebooks, but hadn’t heard of tmuxp before. This is great stuff!

(Chan Sooi Loong) #3

@wgpubs Thanks for sharing this awesome tips.

To add on, if want to enable mouse scrolling, can do this:
vim ~/.tmux.conf

insert into the tmux.conf
set-option -g mouse on

(Andre Brooke) #4

I’ve never used tmux before but it feels so amazing for managing multiple terminals.

It’s well worth it to read The tao of tmux to get yourself up to speed on how to utilize tmux best.

Thanks for the share @wgpubs!

(WG) #5

Can an admin wikify this so I can update?