For those who run their own AI box, or want to

Local Jupyter From Scratch

In case its of use to others, here is my log of installing Jupyter to run locally on Windows Subystem for Linux, accessed through a web browse running on Windows Desktop. I’d be glad to hear of suggestions for improvements.

The purpose is to faciliate development of the inferencing app, so CPU is sufficient and complexity of GPU for training is not considered.

Installed fresh Ubuntu 20.04 LTS

C:\> wsl --unregister Ubuntu
C:\> wsl --install -d Ubuntu

$ cat /etc/lsb-release
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=20.04
> DISTRIB_CODENAME=focal
> DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
# Checked internet connectivity, Google DNS server always alive...
$ ping 8.8.8.8
> PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=56 time=58.5 ms

# Checked DNS
$ ping google.com
> ping: google.com: Temporary failure in name resolution

# The following two steps only required if ping failed.

# Configured DNS - only needed if previous step failed.
$ sudo sh -c 'echo nameserver 8.8.8.8 > /etc/resolv.conf'
$ ping google.com
> PING google.com (142.250.70.206) 56(84) bytes of data.
> 64 bytes from mel05s01-in-f14.1e100.net (142.250.70.206): icmp_seq=1 ttl=56 time=59.7 ms

# Prevented WSL overwriting DNS settings
$ sudo sh -c 'echo "[network]\ngenerateResolvConf = false" > /etc/wsl.conf'
$ cat /etc/wsl.conf
> [network]
> generateResolvConf = false

Installed fast.ai

# Install fastai
$ wget -O - https://raw.githubusercontent.com/fastai/fastsetup/master/setup-conda.sh | /usr/bin/env bash

# Test Jupyter - its not installed
$ jupyter notebook
> (base) ben@OFI-PC-0004:~$ jupyter notebook
> Command 'jupyter' not found, but can be installed with:
> sudo apt install jupyter-core
# DO NOT INSTALL JUPYTER IN SYSTEM, as suggested above, use conda/mamba instead

Installed Jupyter

in base env rather than separate environment.

$ mamba install -c conda-forge notebook
>Looking for: ['notebook']
>Pinned packages:
>  - python 3.9.*
>Transaction
> Prefix: /home/ben/mambaforge
>
>  Change:
>  - certifi                        2021.10.8  py39hf3d152e_1     installed
>  + certifi                        2021.10.8  py39hf3d152e_2     conda-forge/linux-64     148kB
>
>  Upgrade:
>  - openssl                           1.1.1l  h7f98852_0         installed
>  + openssl                           1.1.1o  h166bdaf_0         conda-forge/linux-64       2MB

$ mamba install -c conda-forge nb_conda_kernels

$ mamba install -c conda-forge jupyter_contrib_nbextensions

$ mamba install -c fastchan fastai nbdev

$ which jupyter
> /home/ben/mambaforge/bin/jupyter

Ran jupyter

$ jupyter notebook
>[I 00:10:50.443 NotebookApp] [nb_conda_kernels] enabled, 1 kernels found
>[I 00:10:50.451 NotebookApp] Writing notebook server cookie secret to /home/ben/.local/share/jupyter/runtime/notebook_cookie_secret
>[I 00:10:50.588 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.4.1
>[I 00:10:50.590 NotebookApp] Serving notebooks from local directory: /home/ben
>[I 00:10:50.590 NotebookApp] Jupyter Notebook 6.4.11 is running
>    Or copy and paste one of these URLs:
        http://localhost:8888/?token=5bb5ea9170b3c4cd4d6d32c3e14bd66378026eab8e907d9f

Pasted that URL into Chrome back in Windows Deskop…

Done. Yay!

[Edit:] If your DNS settings later get overridden, see…
https://forums.fast.ai/t/for-those-who-run-their-own-ai-box-or-want-to/96064/159#solved-retaining-wsl-dns-configuration-1

2 Likes