'How to access remote Jupyter Labs instance IPython hosted from Ubuntu
I have a Linux Ubuntu computer on a LAN where I am attempting to run Jupiter labs on it a Jupyter server where I can dial into a Jupyter notebook via the web browser. Hopefully that makes sense I can hit IPython Jupyter lab instance via a web browser from a different machine. Its just on a test bench on my LAN so no need for server hardening or TLS/SSL or anything like that.
Odd thing that I am running into is Pandas isn't even installed on it and errors when I attempted to install. Python kernel in IPython is running ok. I tested with with 2*2 which returns 4 as expected but when I pip install pandas it errors. odd to me that the linux version of Anaconda does NOT include pandas? On a windows anaconda distribution I can pip install via the IPython cell no problems. Any tips appreciated troubleshooting first time experience working with Jupyter server and linux.
Very long error after this:
Collecting pandas
Using cached https://files.pythonhosted.org/packages/99/f0/f99700ef327e51d291efdf4a6de29e685c4d198cbf8531541fc84d169e0e/pandas-1.3.5.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.17.3; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in /home/ben/snap/jupyter/common/lib/python3.7/site-packages (from pandas) (1.21.5)
Requirement already satisfied: python-dateutil>=2.7.3 in /snap/jupyter/6/lib/python3.7/site-packages (from pandas) (2.8.0)
Collecting pytz>=2017.3 (from pandas)
Using cached https://files.pythonhosted.org/packages/60/2e/dec1cc18c51b8df33c7c4d0a321b084cf38e1733b98f9d15018880fb4970/pytz-2022.1-py2.py3-none-any.whl
Requirement already satisfied: six>=1.5 in /snap/jupyter/6/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas) (1.12.0)
Building wheels for collected packages: pandas
Building wheel for pandas (PEP 517) ... error
ERROR: Complete output from command /snap/jupyter/6/bin/python /snap/jupyter/6/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpqm1ihgpj:
Bottom of the error:
error: command 'gcc' failed: No such file or directory: 'gcc'
----------------------------------------
ERROR: Failed building wheel for pandas
Running setup.py clean for pandas
Failed to build pandas
ERROR: Could not build wheels for pandas which use PEP 517 and cannot be installed directly
Note: you may need to restart the kernel to use updated packages.
Solution 1:[1]
THIS WORKS to access Anaconda Jupyter labs IPython remotely via the browser. Jupyter labs is running on Ubuntu and I am pulling up a web browser from a Windows machine hosted by the Ubuntu machine.
Step One: installing Anaconda on Ubuntu 20.04 Linux via these directions. (Make sure you add PATH option)
Step Two: via SSH into the Ubuntu machine setup config file will allow remote access to the Ubuntu machine.
Step Three: modify the config file via nano jupyter_notebook_config.py this file is a hidden file I found via $ ls -a in my home/username linux directory. This file was created already but generate it via the directions if these steps haven't been done prior.
In nano modify the file with nano jupyter_notebook_config.py uncomment and change this:
# Local IP addresses (such as 127.0.0.1 and ::1) are allowed as local, along
# with hostnames configured in local_hostnames.
c.NotebookApp.allow_remote_access = True
And this further down change localhost to 0.0.0.0:
## The IP address the notebook server will listen on.
c.NotebookApp.ip = '0.0.0.0'
save via nano the nano jupyter_notebook_config.py.
Step Four: Setup the Ubuntu Jupyter username and password, these directions are also in the link above to set the username & password for remote access to the IPython/Jupyter Labs:
$ jupyter notebook password
Step Five:
Make sure firewall is opened up on remote Ubuntu instance:
$ sudo ufw allow from any to any port 8888 proto tcp
On the remote linux instance start Jupyter notebook no browser option:
$ jupyter notebook --no-browser
With these steps I can hit my Ubuntu machine running Jupyter labs via the browser from a Windows machine on my LAN. like this: http://192.168.0.100:8888/
ONE CAVEAT is I need to run TMUX to keep Jupyter labs alive if I close the SSH session.
In my SSH session, type tmux, the screen will turn green colored. Then once tmux is running type: jupyter notebook --no-browser then a cntrl-b then the d key to disconnect tmux. This works for me....
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
