Virtual Environments, Jupyter Notebook, and SSH

273 views
Skip to first unread message

Timothée Stassin

unread,
Sep 7, 2022, 9:00:12 AM9/7/22
to Sepal Users
Hi,

I am new to Sepal, trying to setup my workspace on the platform. So maybe the answer to my questions is more related to the approach I am following than to debugging.

For my project, I have created a dedicated folder and set up and activated a python virtual environment, with following commands in Sepal terminal:

pip install virtualenv
mkdir my_project
cd my_project
python3.8 -m venv env
source env/bin/activate

I have then installed using pip a series of packages, including jupyter notebook. Since there is no browser, I assume I need to connect with SSH to Sepal (remote server) from my laptop (local machine), to be able to run jupyter notebook --no-browser.

I fetched the IP address of the remote server using the command hostname -I. When I try to connect to it from my local machine using the command ssh my_username@IP_address, I get the following error:

ssh: connect to host IP_address port 22: Connection timed out

Thanks in advance for the assistance !
Cheers,
Tim

Timothée Stassin

unread,
Sep 8, 2022, 3:42:26 AM9/8/22
to Sepal Users
Another user (thanks !) provided me the answer for the first step.
The right command to connect to Sepal with via SSH is:

me@local:~$ ssh my_use...@ssh.sepal.io -p 443

Now comes the second step, starting jupyter notebook and port forwarding:

me@sepal:~$ cd my_project
me@sepal:~$ source env/bin/activate
(env) me@sepal:~/my_project$ jupyter notebook --no-browser --port=8891

    To access the notebook, open this file in a browser:
        file:///home/my_user_name/.local/share/jupyter/runtime/nbserver-861-open.html
    Or copy and paste one of these URLs:
        http://localhost:8891/?token=12345abcde12345abcde12345abcde12345abcde
     or http://127.0.0.1:8891/?token= 12345abcde12345abcde12345abcde12345abcd

me@local:~$ ssh -N -f -L localhost 8888:localhost:8891 my_use...@ssh.sepal.io

and... nothing happens. And if I try opening localhost:8888 in browser, also nothing happens. Any bright user can further help me ? Much appreciated :) !

Cheers,
Tim

Pierrick Rambaud

unread,
Sep 12, 2022, 5:08:17 AM9/12/22
to Sepal Users
I don't really know how to open Jupyter notebook from the SSH tunnel but I think it's worth mentioning an alternative development setup. 


If you're not familiar with JupyterLab and prefer the good old Jupyter Notebook, it's available as well and the venv will also appear in the kernel list. 

Reply all
Reply to author
Forward
0 new messages