Setup Remote Jupyter Notebook
- A: my laptop, will be used to get access to a notebook running on B, through a web browser
- B: my desktop, runs conda as the python env manager, with address pi@10.0.0.101
- B is a powerful machines with GPU. We start a jupyter notebook on B and get access to it from A
Step1.
From A:
1
|
ssh -N -L 8888:127.0.0.1:8888 pi@10.0.0.101
|
Step2.
From B:
Use conda as the kernel, supposedly we already created an env named “finetune”
1
2
3
4
5
6
7
8
9
10
11
12
|
# activate the conda kernel
conda activate finetune
# install a package
pip install ipykernel
# add this conda kernel for notebook, with kernel name "conda-finetune" (to be showed on notebook UI)
python -m ipykernel install --user --name conda-finetune
#finally start the jupyter notebook
jupyter notebook --no-browser
|
It will show
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
_ _ _ _
| | | |_ __ __| |__ _| |_ ___
| |_| | '_ \/ _` / _` | _/ -_)
\___/| .__/\__,_\__,_|\__\___|
|_|
Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.
https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html
Please note that updating to Notebook 7 might break some of your extensions.
[I 00:37:45.314 NotebookApp] Serving notebooks from local directory: /home/pi/workspace/notebooks
[I 00:37:45.314 NotebookApp] Jupyter Notebook 6.5.4 is running at:
[I 00:37:45.314 NotebookApp] http://localhost:8888/?token=c3720ef1291c91c1b50d51f3cac642b26b6abacbaf95a972
[I 00:37:45.314 NotebookApp] or http://127.0.0.1:8888/?token=c3720ef1291c91c1b50d51f3cac642b26b6abacbaf95a972
[I 00:37:45.314 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 00:37:45.315 NotebookApp]
To access the notebook, open this file in a browser:
file:///home/pi/.local/share/jupyter/runtime/nbserver-75313-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=c3720ef1291c91c1b50d51f3cac642b26b6abacbaf95a972
or http://127.0.0.1:8888/?token=c3720ef1291c91c1b50d51f3cac642b26b6abacbaf95a972
|
copy the last line:
http://127.0.0.1:8888/?token=c3720ef1291c91c1b50d51f3cac642b26b6abacbaf95a972
Step3.
On A:
copy and paste the URL onto a webbrowser. You should be able to see the notebook UI.
When creating a new notebook, you can choose the kernel “conda-finetune”