Local Linux Setup (with tmux/p and anaconda)

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.

UPDATED - 11/2/2019


INSTALLATION STEPS:

  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
windows:
- window_name: dev window
  layout: main-vertical
  options:
    main-pane-width: 140
  shell_command_before:
    # run as a first command in all panes
    - cd ~/development/_training/ml/fastai-courses/course-v3
    - source activate fastai-course-v3
  panes:
    - 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 essential bits you’ll need to get started (see also the fastai readme). Note: The line for installing PyTorch is that provided from the PyTorch homepage for Linux, Python 3.7, and CUDA version 10.1. Should any of those parameters differ for your use case, please consult their instructions based on your configuration.
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
conda install -c fastai fastai
  1. Install Jupyter notebook and the extensions into your new conda environment. If you don’t do this and you have other conda environments on your machine, you are likely to encounter all kinds of interesting errors about Python not being able to find this package or that package that you’ve installed into your environment when running the notebooks.
conda install jupyter
conda install -c conda-forge jupyter_contrib_nbextensions
  1. Exit tmux and kill the current session via tmux kill-server. This step is basically here to ensure that any of the installed packages that might not otherwise work correctly without a restart, will be configured correctly. From here you can reload your tmux session via tmuxp load fastai-course-v3 and be good to go.

Done!

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. You should be able to go from logging into your Linux box to running notebooks in less than 5 seconds.

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


KEEPING THINGS UPDATED STEPS:
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.x builds:

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

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
conda install -c fastai fastai

HELPFUL RESOURCES

This thread has a bunch of helpful information as well.

14 Likes

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

@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

1 Like

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!

2 Likes

Can an admin wikify this so I can update?

is there an up-to-date version for this? torchvision-nightly can’t be found on that channel.

Let me see if I can get one of the admins to wikify this or otherwise give me the ability to update. Hold on :slight_smile:

thanks. I’ve also prepared an easy to use docker setup with gpu support if anyone’s interested.
Posted it here.

It’s updated now (and wikified).