Exposing python jupyter on LAN - python

I've installed jupyter on local network LAN but im unable to access http://<IP>:8888 from another macine on LAN. I've opened ports 8888 and port range 49152 to 65535 with iptables (this range is specified at http://jupyter-notebook.readthedocs.io/en/latest/public_server.html)
This guide http://jupyter-notebook.readthedocs.io/en/latest/public_server.html describes exposing a notebook publicly but I'm just attempting to share over LAN.
Have I missed a step ?

Try jupyter notebook --ip <your_LAN_ip> --port 8888
Then visit http://your_LAN_ip:8888 from another computer.
It's recommended that you use a password when accessing your notebook server. To set up a password, just run jupyter notebook password. To make it even more secure, you can use SSL for your server by passing the arguments --certfile and --keyfile to jupyter notebook. You can read more about setting that up here.

In macOS, the following worked for me
0. Generate configure file using
jupyter notebook --generate-config
1. Set in configure file and add
c.NotebookApp.ip = '0.0.0.0' # listen on all IPs
c.NotebookApp.token = '' # disable authentication
c.NotebookApp.allow_origin = '*' # allow access from anywhere
c.NotebookApp.disable_check_xsrf = True # allow cross-site requests
2. Run:
jupyter notebook --ip <your_LAN_ip> --port 8888

It's also possible to add the IP/host in the configuration file in the c.NotebookApp.ip = '<your_ip_or_hostname>' and c.NotebookApp.port = 8888 parameters.
If you don't have a jupyter configuration file yet run jupyter notebook --generate-config

Related

Jupyter notebook gives no error but doesn't open port connection

I'm trying to connect and use jupyter notebooks on a Windows remote desktop. I can install jupyter fine and even run it perfectly, but whenever I try to access the notebook via browser, I get a "can't reach" message for localhost:8888.
After some extensive research online, where people just needed to change 127.0.0.1 to localhost or vice versa, or changed their browser, nothing seemed to work. Some threads also suggested I change up the config file and instead run jupyter notebook --ip 0.0.0.0 --port 8888. Furthermore, I tried using several different ports and even asked the IT administrator which port is definetly available, but this was all to no avail.
Delving deeper into the problem, I checked whether jupyter opened a port connection on the remote desktop by running netstat -aon | findstr :*port* in the terminal. This was not the case.
I'm dumbfounded how jupyter notebook doesn't return an error while not actually creating a port connection on the remote machine. Seeing as I can easily set up a port connection through python -m http.server 8888 I have no idea how to tackle this problem. Any idea on why jupyter doesn't seem to open a port connection and how this can be remedied?

I can ping to the Win10 successfully from my Mac. I cannot access the jupyter with chrome/edge browser from my Mac. How do I do?

I'm running jupyter-notebook 6.3.0 on Microsoft Windows [Version 10.0.19042.1165].
I've set the config file following the doc
c.NotebookApp.password = u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
c.NotebookApp.ip = '*'
I can access the jupyter on my Win10 with chrome/edge browser with http://192.168.1.108:8888
I can ping to the Win10 (192.168.1.108) successfully from my Mac.
I cannot access the jupyter (http://192.168.1.108:8888) with chrome/edge browser from my Mac and get this error
xxx is currently unable to handle this request.
HTTP ERROR 503
How do I do?
Try jupyter notebook --ip <your_LAN_ip> --port 8888 Then visit http://your_LAN_ip:8888 from another computer.
Or
In your case replace the line c.NotebookApp.ip = '*' with c.NotebookApp.ip = '0.0.0.0' to listen on all IPs
And add these two lines
c.NotebookApp.allow_origin = '*' # allow access from anywhere
c.NotebookApp.disable_check_xsrf = True # allow cross-site requests
It's recommended that you use a password when accessing your notebook server. To set up a password, just run jupyter notebook password. To make it even more secure, you can use SSL for your server by passing the arguments --certfile and --keyfile to jupyter notebook

Can't open Jupyter Noteboook on local

I am trying to run jupyter from local mac terminal. It used to work but not working when I did some changes in jupyter config file to connect the notebook to a remote server jupyter (which nev er worked without tunneling btw).
Here is the changes I did then:
# 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 = False
c.NotebookApp.allow_remote_access = True
So adding True to allow_remote_access option while keeping the default commented.
But now when I do "jupyter notebook" in termina directory, it keeps showiing opening in browser but never opens.

Connecting Jupyter notebook to Remote server

I have a linux server. On that I have installed Miniconda3 and other python packages along with Jupyter.
Now I want to run the notebook on the server and open in my browser.
For that, after installation of all packages, I do:
user#remoteip:$ jupyter notebook --no-browser --port=8890
Now I am copying the server IP address along with port to open it in my local browser.
http://remoteip:8890
However it doesn't open up anything.
I then followed all suggestions given in this SO answer by adding the required statements in the configuration file on the remote server anaconda and even local anaconda jupyter config file.
But it doesn't help at all.
After that I had to port forwarding as below in my local terminal:
user#localhost: ssh -N -f -L localhost:8890:localhost:8890 user#remoteip
And after that when I open
localhost:8890
now it opens up the notebook requiring the token to be entered and then it works.
My question is that do we need to do port forwarding everytime for us to open a notebook on remote server? One of my colleague said he didn't do any port forwarding and after first step itself, he was able to open the notebook with by typing
http://remoteip:8890
So I am not sure we need to do port forwarding for us to open the server jupyter notebook to open in browser or we can directly open the notebook with remoteip address?
Edit:
As per Alex's suggestion below, ran the following command after logging into dev server.
(ds_env) user#devvm1049:~$ jupyter notebook --no-mathjax --no-browser --ip 0.0.0.0 --port 8890
[I 23:49:56.032 NotebookApp] Serving notebooks from local directory: /home/user
[I 23:49:56.032 NotebookApp] The Jupyter Notebook is running at:
[I 23:49:56.032 NotebookApp] http://devvm.cdw.com:8890/
[I 23:49:56.032 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Copied the above link to both chrome and Safari but it didn't open anything.
I have already done the above suggestions in this post. The only thing that has worked until now is doing Port tunneling but that is 3 steps everytime one has to open the jupyter on remote server.
Is this can be some port blocking issue? I tried pinging the remote server on laptop and it didn't give me any ping.
If you specify the --ip option when starting the server you can allow remote connection without port forwarding.
jupyter notebook --no-mathjax --no-browser --ip 0.0.0.0 --port 8890
# The --no-mathjax improves loading over slow connections
This is not recommended, though. See running a public jupyter notebook server. If you do this, I strongly recommend that you set a password, as described in that link.

IPython notebook WebSocket connection could not be established. You will NOT be able to run code

I've been tryin to run some simple code in IPython notebook but i keep getting this error:
"A WebSocket connection could not be established. You will NOT be able to run code. Check your network connection or notebook server configuration."
There were no problems during the install and there are no error messeges when i load the notebook.
I'm thinking maybe it has something to do with the fact im running my local server on xamp?
Doed anyone have a clue how to solve this?
I would be very greatfull.
Edit: I'm loading my notebook using the command 'ipython notebook' in the command prompet the output is:
[NotebookApp]"Using existing profile dir: c:\users\Nimrod\.ipython\profile_default
[NotebookApp]using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/mathjax.js
[NotebookApp] Serving notebooks from local directory c:\users\Nimrod
[NotebookApp] 0 active kernels
[NotebookApp] use control c to stop server and shut doen all kernels
[NotebookApp] Kernel started: 0ac0db12-63a0-4a4a-be25-0051
Thanks a lot.
Okay, by default ipython notebook launches standalone using the tornado http server running on local port 8888.
Try typing localhost:8888 into your browser.
If you want to customize it to run on a different port use:
ipython notebook --port=<NEW PORT>
If you'd also like to allow connections from remote machines do:
ipython notebook --ip=0.0.0.0 --port=<NEW PORT>

Categories