2022/06
jupyter notebook
pip3
virtualenv
jupyter notebook server
(2022/6/17) After installation of GPU Driver, CUDA and cuDNN, it will be easier to user Jupyter Notebook for (Python based) ML (Machine Learning)/DL (Deep Learning) application programming . So naturally next step is to install Jupyter Notebook.
(For people not familiar with ML/DL applications, I would suggest to install Anaconda which includes Jupyter Notebook and package managers. It is more user friendly for ML newbies.)
I refer to these articles, How to install Jupyter Notebook on Ubuntu 20.04, and Run Jupyter Notebook Through Remote Rerver on local machine for this note.
Ubuntu 18.04 already includes Python3 as the default Python, and excludes Python2. Still need to install pip3 separately.
Please don't use sudo
for Python3 and pip3 related instructions, as it is user applications. This reminder is from my past experiences when I encountered some Python3 or pip3 errors. I was thinking to solve it by adding sudo
, which is a bad idea. Instead, find the root cause before trying sudo
, unless you would like to install those commands for all users. Below one is one example using sudo
as alternative.
It is a good habit to use virtualenv
for different Python applications with different environment settings when there are so many applications and versions dependency and, sometimes, conflicting. Install virtualenv and related set up will hep to avoid such conflicts.
Add new user jupyter
(without sudo
priviledge).
Set up virtualenv
for user jupyter
Everything is all set, and ready to launch with following command line instructions.
It will still work even when there are some error, will figure it out later what errors are. Can continue by opening web browser and copy the following URL starting with http://localhost:8888/?.....
, the strings after ?
will change everytime when virtualenv notebook
is launched.
The browser will look like below screenshot. Can click the Python3 to start coding.
When you want to exit Jupyter Notebook, go back to terminal
, and press CTRL-c
to stop Jupyter Notebook.
Then use deactivate
to exit the virtual environment.
Jupyter Notebook support server-client mode with remote access. It will be faster with local browser connected to Jupyter Notebook server, without logging to Server GUI which consumers more bandwith.
First, still at server terminal
to launch Jupyter Notebook command. The setting of --no-browser
is to support remote client browser by skipping browser supoprt on server.
Copy the string start with http://localhost:8080/....
for later use.
2nd, go the the client PC. I have Windows 10 installed on my notebook PC, and use MobaXterm to connect to the server.
The first port 8080 is the port defined in Jupyter Noteoobk, and the 2nd port 8080 will be used in client browser.
We use jupyter
user to log in as we already add user earlier on server.
You might need to change the IP address of your server, which is the same as you log on to server for installation.
Launch browser (I user Microsoft Edge more often than Chrome nowadays), and copy the previous string http://localhost:8080/....
to the browser. Then it is ready to go.
Previous article - Install NVIDIA GPU
Next article - Install Darknet
back to marconi's blog