I am trying to run an ipython notebook / jupyter server on a machine behind a firewall. The only port which is open is port 80. So was wondering how I can change the default por
To change port temporarily, indicate a different port number when we start jupyter notebook server from a terminal by firing following command.
jupyter notebook --port 9999
Read more https://jupyter.readthedocs.io/en/latest/running.html
In Jupyter we can start the notebook on different port by two ways.
jupyter notebook --port 9999
Permanent port Configuration - By changing the configuration we can run Jupyter on different port on the machine permanently. Please follow the below steps for that.
nano ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.port = 9999
jupyter notebook
Bingo!!!
ipython notebook --ip=0.0.0.0 --port=80 or
jupyter notebook --ip=0.0.0.0 --port=80
is what i did to run ipython in my vagrant box. (Opened up the ports on the vagrant box to access it on my host mac)
usage: ipython [-h] [--certfile NOTEBOOKAPP.CERTFILE] [--ip NOTEBOOKAPP.IP]
[--pylab [NOTEBOOKAPP.PYLAB]]
[--log-level NOTEBOOKAPP.LOG_LEVEL]
[--port-retries NOTEBOOKAPP.PORT_RETRIES]
[--notebook-dir NOTEBOOKAPP.NOTEBOOK_DIR]
[--config NOTEBOOKAPP.CONFIG_FILE]
[--keyfile NOTEBOOKAPP.KEYFILE] [--port NOTEBOOKAPP.PORT]
[--transport KERNELMANAGER.TRANSPORT]
[--browser NOTEBOOKAPP.BROWSER] [--script] [-y] [--no-browser]
[--debug] [--no-mathjax] [--no-script] [--generate-config]
Incase the port is already occupied, see what's blocking it - inmy case it was an old instance of ipython which had not been terminated properly. I kiiled them all with this command
ps auxww | grep 'ipython' | awk '{print $2}' | xargs sudo kill -9
Something is already listening on 80, you cannot bind 2 servers to the same port. Use a proxy that listen to 80, and redirect to your other servers and IPython base on URL, or address. Also don't use 80, use 443, if you are running a public server it should be over TLS for security.
Note that for any low port number you might need to increase the process privileges to root, potentially using sudo.
Just FYI, running in a Docker container and changing the config to use port 80:
c.NotebookApp.port = 80
Causes these errors in turn:
[W 18:11:42.852 NotebookApp] Permission to listen on port 80 denied.
[W 18:11:42.853 NotebookApp] Permission to listen on port 81 denied.
[W 18:11:42.854 NotebookApp] Permission to listen on port 82 denied.
[W 18:11:42.855 NotebookApp] Permission to listen on port 83 denied.
[W 18:11:42.856 NotebookApp] Permission to listen on port 84 denied.
[W 18:11:42.857 NotebookApp] Permission to listen on port 49 denied.
[W 18:11:42.857 NotebookApp] Permission to listen on port 24 denied.
[W 18:11:42.858 NotebookApp] Permission to listen on port 114 denied.
[W 18:11:42.859 NotebookApp] Permission to listen on port 58 denied.
[W 18:11:42.860 NotebookApp] Permission to listen on port 81 denied.
[W 18:11:42.860 NotebookApp] Permission to listen on port 153 denied.
[W 18:11:42.861 NotebookApp] Permission to listen on port 66 denied.
[W 18:11:42.862 NotebookApp] Permission to listen on port 60 denied.
[W 18:11:42.862 NotebookApp] Permission to listen on port 73 denied.
[W 18:11:42.863 NotebookApp] Permission to listen on port 103 denied.
[W 18:11:42.863 NotebookApp] Permission to listen on port 123 denied.
[W 18:11:42.864 NotebookApp] Permission to listen on port 131 denied.
[W 18:11:42.864 NotebookApp] Permission to listen on port 123 denied.
[W 18:11:42.865 NotebookApp] Permission to listen on port 21 denied.
[W 18:11:42.865 NotebookApp] Permission to listen on port 66 denied.
[W 18:11:42.866 NotebookApp] Permission to listen on port 156 denied.
[W 18:11:42.867 NotebookApp] Permission to listen on port 107 denied.
[W 18:11:42.867 NotebookApp] Permission to listen on port 1 denied.
[W 18:11:42.868 NotebookApp] Permission to listen on port 140 denied.
[W 18:11:42.869 NotebookApp] Permission to listen on port 54 denied.
[W 18:11:42.869 NotebookApp] Permission to listen on port 81 denied.
[W 18:11:42.869 NotebookApp] Permission to listen on port 134 denied.
[W 18:11:42.870 NotebookApp] Permission to listen on port 148 denied.
[W 18:11:42.871 NotebookApp] Permission to listen on port 27 denied.
[W 18:11:42.871 NotebookApp] Permission to listen on port 1 denied.
[W 18:11:42.872 NotebookApp] Permission to listen on port 137 denied.
[W 18:11:42.873 NotebookApp] Permission to listen on port 33 denied.
[W 18:11:42.874 NotebookApp] Permission to listen on port 163 denied.
[W 18:11:42.875 NotebookApp] Permission to listen on port 1 denied.
[W 18:11:42.876 NotebookApp] Permission to listen on port 59 denied.
[W 18:11:42.877 NotebookApp] Permission to listen on port 34 denied.
[W 18:11:42.878 NotebookApp] Permission to listen on port 74 denied.
[W 18:11:42.879 NotebookApp] Permission to listen on port 126 denied.
[W 18:11:42.880 NotebookApp] Permission to listen on port 92 denied.
[W 18:11:42.880 NotebookApp] Permission to listen on port 161 denied.
[W 18:11:42.881 NotebookApp] Permission to listen on port 1 denied.
[W 18:11:42.882 NotebookApp] Permission to listen on port 124 denied.
[W 18:11:42.883 NotebookApp] Permission to listen on port 146 denied.
[W 18:11:42.883 NotebookApp] Permission to listen on port 1 denied.
[W 18:11:42.884 NotebookApp] Permission to listen on port 155 denied.
[W 18:11:42.884 NotebookApp] Permission to listen on port 57 denied.
[W 18:11:42.885 NotebookApp] Permission to listen on port 1 denied.
[W 18:11:42.886 NotebookApp] Permission to listen on port 1 denied.
[W 18:11:42.887 NotebookApp] Permission to listen on port 139 denied.
[W 18:11:42.887 NotebookApp] Permission to listen on port 68 denied.
[W 18:11:42.887 NotebookApp] Permission to listen on port 14 denied.