(base) C:\Users\kpl16587.KPLC>d:
(base) D:>jupyter notebook
[I 13:47:49.286 NotebookApp] The port 8888 is already in use, trying another port.
[I 13:47:49.289 NotebookApp] The port 8889 is already in use, trying another port.
[I 13:47:49.291 NotebookApp] The port 8890 is already in use, trying another port.
I reinstalled Jupyter since i could not launch and now i get the above error.
Please assist.
Figured it out, by modifying C:\Users\username.jupyter\jupyter_notebook_config.py
line---#c.NotebookApp.browser = ''
to
---#c.NotebookApp.browser =u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'
Now Jupyter notebook launching perfectly.
Related
Suppose I've a Jupyter notebook loaded in a browser. Is that possible to somehow run a command line ipython session which connect to the same kernel insance as the one used by the notebook (i.e they can see the same set of variables)? Thanks.
Yes! After starting/loading an IPython notebook, open up a terminal and connect a command line ipython session using the --existing parameter:
jupyter console --existing
By default, it will connect to the latest started IPython kernel. To select a different kernel to connect to, look in the log of the Jupyter notebook for lines like these:
[I 09:47:54.462 NotebookApp] Kernel started: 06c9ffae-ae9f-4c22-93c0-4eacf23672b1
To connect to this kernel, do:
jupyter console --existing 06c9ffae-ae9f-4c22-93c0-4eacf23672b1
With JupyterLab it's possible to open a linked console by right clicking on any Notebook and selecting New Console for Notebook (as mentioned in #machine_building's comment on this answer). That will show a connected console beside/below the Notebook, which one can interact with like in a terminal with command history etc.
i have two machines connected via lan.
other system's ip address is 192.1xx.x.x
i want to run jupyter ipython query's on my machine which can be exexuted on his machine.
at the start of ipython notebook, there is a black screen which contains this:
[I 11:12:52.802 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
can i change this to my specified location?
You can specify the port you want Jupyter to run uncommenting/editing the following line in ~/.jupyter/jupyter_notebook_config.py:
#c.NotebookApp.port = 8888
In case you don't have a jupyter_notebook_config.py try running jupyter notebook --generate-config. See this for further details on Jupyter configuration.
In case you are accessing Jupyter at a remote machine you can also try just leaving Jupyter running at its default port and make an SSH tunnel to your local machine at the port you want, e.g.:
ssh -fNL <new port>:localhost:8888 <your ssh config>
Run the Anaconda Prompt, generate the config file, if you don't have it and edit the config file and change c.NotebookApp.ip with your IP Adress '192.1xx.x.x'
On Anaconda Prompt:
If the file not exist, generate a config file:
jupyter notebook --generate-config
Output:
(base) C:\Users\youruser>jupyter notebook --generate-config
Writing default config to: C:\Users\youruser\.jupyter\jupyter_notebook_config.py
(base) C:\Users\youruser>
Change to jupyter directory:
cd .jupyter
Modify the config file from:
## The IP address the notebook server will listen on.
#c.NotebookApp.ip = 'localhost'
To:
## The IP address the notebook server will listen on.
c.NotebookApp.ip = '192.1xx.x.x'
First you need to generate a configuration file by typing:
$> jupyter notebook --generate-config
Writing default config to: /{home-directory}/.jupyter/jupyter_notebook_config.py
Next you need to edit that configuration to change the port number:
vi /{home-directory}/.jupyter/jupyter_notebook_config.py
Look for the following line (which is commented out by default) and comment in the line and change the port number:
(default configuration)
## The port the notebook server will listen on.
# c.NotebookApp.port = 8888
(comment removed, port changed)
## The port the notebook server will listen on.
c.NotebookApp.port = 9999
On a Mac, I had to use my machine's name instead of localhost.
To get this, open a terminal and run:
hostname
So in the browser, instead of localhost:8888/... I entered mac-mini.home:8888/... (where ... represents the rest of the url).
I'd like to find out where in the Jupyter config this can be overridden, because it is not intuitive, IMO.
When i try to run jupyter it shows me this error :-
ERROR: the notebook server could not be started because no available port could be found.
Terminal Logs are as follows:-
[I 20:52:08.747 NotebookApp] The port 8888 is already in use, trying another random port.
[I 20:52:08.748 NotebookApp] The port 8889 is already in use, trying another random port.
[I 20:52:08.748 NotebookApp] The port 8890 is already in use, trying another random port.
[I 20:52:08.749 NotebookApp] The port 8891 is already in use, trying another random port.
[I 20:52:08.750 NotebookApp] The port 8892 is already in use, trying another random port.
[I 20:52:08.750 NotebookApp] The port 8988 is already in use, trying another random port.
[C 20:52:08.779 NotebookApp] ERROR: the notebook server could not be started because no available port could be found.
And, I also checked my system to check which process is running on that port and I found that no process is running and none of these ports are used by any process. But, I still get that error.
I also changed a default port of jupyter to various other port, but still get the same error.
I faced the same problem then run with
jupyter notebook --port 9999
This work for me jupyter notebook stop 8888 or
jupyter notebook --ip=0.0.0.0 --port=8888
I found solution here
I know it sounds silly, but I've just run into this problem and restarted my OS, and the error was gone!
The error may not be cause by jupyter, but your system.
To clear this, you can try open a simple http server on port 8888 and see whether the failed message is the same.
You can try one of the following commands to start a http server:
python -m SimpleHTTPServer 8888 (Python2)
python -m http.server 8888 (Python3)
I once have met this. It is because your interpreter. The version interpreter of your current project is not suitable for your anaconda. You can change your interpreter and then connect jupyter. That may be helpful. (:D
The solution is simple in Ubuntu and WSL:
jupyter notebook --allow-root --port 9999
I'm using django-extensions and I ran shell_plus --kernel and it output:
To connect another client to this kernel, use:
--existing kernel-6690.json
Then I tried connecting with Jupyter:
$ jupyter notebook --existing=kernel-6690.json
[W 10:44:59.290 NotebookApp] Unrecognized alias: '--existing=kernel-6690.json', it will probably have no effect.
...
Why doesn't Jupyter connect to the kernel?
Reviewing https://github.com/ipython/ipython/issues/4066, it appears that the notebook is not able to connect to kernels. In other words for all the talk about how Jupyter notebook is separated into a kernel and frontend it's actually not and this information is not written in any documentation I could find.
Jupyter notebook does not support connecting to an existing kernel. shell_plus --notebook does close enough to what I want.
I am taking my first steps with ipython notebook and I installed it successfully on a remote server of mine (over SSH) and I started it using the following command:
ipython notebook --ip='*' ---pylab=inline --port=7777
I then checked on http://myserver.sth:7777/ and the notebook was running just fine. I then wanted to close the SSH connection with the server and keep ipython running in the background. When I did this, I couldn't connect to myserver.sth:7777 anymore. Once I connected again to the remote server by SSH, I could connect again to the notebook. I then tried to use screen to start ipython: I created a new screen by screen -S ipy, I started ipython notebook as above and I used Ctrl+A,D to detach the screen and exit to the TTY. I could still connect remotely to the notebook. I then closed the SSH connection and I got a 404 NOT FOUND error when I tried to access my previously stored notebook and I couldn't see it on the list of notebook at http://myserver.sth:7777/. I tried to create a new notebook, but I got a 500 Internal Server Error.
I also tried running ipython notebook with and without using sudo.
Any ideas?
Rather than use screen, perhaps you could switch to an init script or supervisord to keep IPython notebook up and running.
Let's assume you go the supervisord route:
Install supervisord
Install supervisord using your package manager. For ubuntu it's named supervisor.
apt-get install supervisor
If you decide to install supervisor through pip, you'll have to set up its init.d script yourself.
Write a supervisor configuration file for IPython
The configuration file tells supervisor what to run and how.
After you install supervisor, it should have created /etc/supervisor/supervisord.conf. These lines should exist in the file:
[include]
files = /etc/supervisor/conf.d/*.conf
If they contain these lines, you're in good shape. I only show them to demonstrate where it expects new configuration files. Your configuration file can go there, named something like /etc/supervisor/conf.d/ipynb.conf.
Here's a sample configuration that was generated by Chef by an ipython-notebook-cookbook that runs the notebook in a virtualenv:
[program:ipynb]
command=/home/ipynb/.ipyvirt/bin/ipython notebook --profile=cooked
process_name=%(program_name)s
numprocs=1
numprocs_start=0
autostart=true
autorestart=true
startsecs=1
startretries=3
exitcodes=0,2
stopsignal=QUIT
stopwaitsecs=10
user=ipynb
redirect_stderr=false
stdout_logfile=AUTO
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10
stdout_capture_maxbytes=0
stdout_events_enabled=false
stderr_logfile=AUTO
stderr_logfile_maxbytes=50MB
stderr_logfile_backups=10
stderr_capture_maxbytes=0
stderr_events_enabled=false
environment=HOME="/home/ipynb",SHELL="/bin/bash",USER="ipynb",PATH="/home/ipynb/.ipyvirt/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games",VIRTUAL_ENV="/home/ipynb/.ipyvirt"
directory=/home/ipynb
serverurl=AUTO
The above supervisor config also relies on an IPython notebook configuration (located at /home/ipynb/.ipython/profile_cooked/ipython_notebook_config.py). This makes configuration much easier (as you can also set up your password hash and many other configurables).:
c = get_config()
# Kernel config
# Make matplotlib plots inline
c.IPKernelApp.pylab = 'inline'
# The IP address the notebook server will listen on.
# If set to '*', will listen on all interfaces.
# c.NotebookApp.ip= '127.0.0.1'
c.NotebookApp.ip='*'
# Port to host on (e.g. 8888, the default)
c.NotebookApp.port = 8888 # If you want it on 80, I recommend iptables rules
# Open browser (probably want False)
c.NotebookApp.open_browser = False
Re-read and update, now that you have the configuration file
supervisorctl reread
supervisorctl update
Reality
In reality, I used to use a Chef cookbook to do the entire installation and configuration. However, using configuration management with tiny stuff like this is a bit of overkill (unless you're orchestrating these in automation).
Nowadays I use Docker images for IPython notebook, orchestrating via JupyterHub or tmpnb.