Run ipython notebook from a remote server
Solution 1
To resolve this problem, I needed to:
Run the notebook server listening on all IP addresses adding cli flag --ip=*:
remote$ipython notebook --no-browser --ip=* --port=8889
Add inbound rule to the amazon ec2 instance in order to listen to port 8889.
+-----------------+----------+------------+-----------+ | Type | Protocol | Port Range | Source | +=================+==========+============+===========+ | Custom TCP Rule | TCP | 8889 | 0.0.0.0/0 | +-----------------+----------+------------+-----------+
Of course now it's better to add authentification as the port is listening to all ip adresses
Solution 2
As Monkpit wrote below, your shell might try to glob *
character. In that case you should write --ip=\*
- Explicitly adding ip address to localhost also helped:
ipython notebook --no-browser --ip=localhost --port=7777
Ben
Updated on July 11, 2022Comments
-
Ben almost 2 years
I'm trying to run a ipython notebook from my remote server(Ubuntu 14.04 64 bits on Amazon EC2).
I can access to ipython notebook via ssh tunnelling as described in coderwall blog:
remote$ipython notebook --no-browser --port=8889
local$ssh -N -f -L localhost:8888:localhost:8889 remote_user@remote_host
However I can't have a simple access using http protocol as described in the official doc or this tutorial
remote$ipython notebook --no-browser --port=8889
And point my local browser to
http://mypublicip:8889
, the browser fails without any warning. -
Viktor Vojnovski over 8 yearsEscaping the star is needed for some shells.
-
Kyle Pittman over 8 yearsThe reason this doesn't work is because the shell tries to expand the glob
*
. Replace with--ip=\*
to escape the glob and you can accept connections from any IP. -
Rafay about 8 yearsPerfect answer! Just change
--ip=localhost
to--ip=yourip
and it should be good.