Jupyter has 0 active kernels (Anaconda with Python 2.7) - anaconda

I've installed Anaconda 2.5 w/Python 2.7. Upon launching jupyter (which is bundled in Anaconda), the python kernel isn't being detected.
The web server launches and listens on 8888. The browser notebook editor works fine. However, I can't run any python code. The "Cell" menu isn't appearing.
Is there a configuration file or something that needs to be installed?
Here's the output from the console:
[I 21:32:27.625 NotebookApp] Serving notebooks from local directory: C:\Users\smilesydney
[I 21:32:27.625 NotebookApp] **0 active kernels**
[I 21:32:27.625 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 21:32:27.627 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

The default port 8888 is blocked, I think.
For single launch this should help:
jupyter notebook --port=8889
To fix that permanently run:
jupyter notebook --generate-config
Then go to ./anaconda/ directory and add
c = get_config()
c.NotebookApp.port = 8889
to file jupyter_notebook_config.py

I fixed that through upgrading the Jupyter in Anaconda.
See https://github.com/jupyter/notebook/issues/2382 for more details.

I had the same issue. Reinstalling ipython solved the problem.

Simply restart the jupyter notebook solved the problem for me.
If one restart doesn't help, restart it again.

Related

Jupyter Notebook Start-up folder to be current folder (Mac)

How do I change Jupyter Notebook's start-up folder to be the directory that I started it in terminal? I have tried jupyter notebook --notebook-dir=%CD% but it gave me an error:
[C 00:31:27.239 NotebookApp] Bad config encountered during initialization:
[C 00:31:27.239 NotebookApp] No such notebook dir: ''/Users/username/%CD%''
Is there a better way to change start-up folder on Jupyter Notebook? Thanks very much in advance.
If I cd into a directory then both jupyter notebook and jupyter lab start in the current folder.
I am running Ventura (13.1).
I changed the configuration of Jupiter Notebook and it worked. Here are the steps:
find the configuration dir at jupyter --config-dir
In the configuration dir, edit jupyter_notebook_config.py and change to or add this line c.NotebookApp.notebook_dir = ''
Now it will start from where the starting directory is.

Hi guys, I am new to jupyter, I used Anaconda Prompt to run jupyter-notebook, but the notebook failed to connect to the kernel

The screenshot of the error I got in the prompt
(base) C:\Users\Ayman>cd desktop
(base) C:\Users\Ayman\Desktop>cd ml
(base) C:\Users\Ayman\Desktop\ML>conda activate ./my_env
(C:\Users\Ayman\Desktop\ML\my_env) C:\Users\Ayman\Desktop\ML>jupyter-notebook
[I 2021-11-24 09:56:06.789 LabApp] JupyterLab extension loaded from C:\Users\Ayman\Desktop\ML\my_env\lib\site-packages\jupyterlab
[I 2021-11-24 09:56:06.789 LabApp] JupyterLab application directory is C:\Users\Ayman\Desktop\ML\my_env\share\jupyter\lab
[I 09:56:06.805 NotebookApp] Serving notebooks from local directory: C:\Users\Ayman\Desktop\ML
[I 09:56:06.805 NotebookApp] Jupyter Notebook 6.4.6 is running at:
[I 09:56:06.805 NotebookApp] http://localhost:8888/?token=724d01899aa45347a06555cc200f7ebdf9c9e843c526ad7d
[I 09:56:06.805 NotebookApp] or http://127.0.0.1:8888/?token=724d01899aa45347a06555cc200f7ebdf9c9e843c526ad7d
[I 09:56:06.805 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:56:06.934 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/Ayman/AppData/Roaming/jupyter/runtime/nbserver-12888-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=724d01899aa45347a06555cc200f7ebdf9c9e843c526ad7d
or http://127.0.0.1:8888/?token=724d01899aa45347a06555cc200f7ebdf9c9e843c526ad7d
[I 09:56:11.958 NotebookApp] Creating new notebook in
Bad address (bundled\zeromq\src\epoll.cpp:100)
[I 09:56:14.576 NotebookApp] Kernel started: 76e00e69-8ea6-47da-900c-b4c4146e8c34, name: python3
(C:\Users\Ayman\Desktop\ML\my_env) C:\Users\Ayman\Desktop\ML>Bad address (bundled\zeromq\src\epoll.cpp:100)
Bad address (bundled\zeromq\src\epoll.cpp:100)
Try this way creating a conda environment using:
conda create -n my_env python=3
Activate the environment using:
source activate my_env
Install the ipykernel using:
conda install ipykernel
ipython kernel install --name my_env --user
Now open the jupyter and select the "my_env" from Kernel option. ( path : jupyter -> kernel -> change kernel -> my_env )

How to make jupyter start in current directory by default (in cmd.exe)?

In Windows 10 cmd.exe I can start jupyter in a current directory by following command:
jupyter notebook --notebook-dir="."
The current directory is C:\Users\Евгений\Documents\GitHub\sandbox
However, when I start simply jupyter notebook in a current directory above my working directory for jupyter is D:/git:
λ cd
C:\Users\Евгений\Documents\GitHub\sandbox
λ jupyter notebook
[I 14:46:44.273 NotebookApp] The port 8888 is already in use, trying another port.
[I 14:46:44.304 NotebookApp] JupyterLab beta preview extension loaded from D:\Anaconda3\lib\site-packages\jupyterlab
[I 14:46:44.304 NotebookApp] JupyterLab application directory is D:\Anaconda3\share\jupyter\lab
[I 14:46:44.571 NotebookApp] Serving notebooks from local directory: D:/git
Note the last line Serving notebooks from local directory: D:/git. Where is D:/git may be coming from? Are there environment variables other than these affecting working directory choice?
My %USERPROFILE%/.jupyter is totally empty.
jupyter --config-dir directs to C:\Users\Евгений\.jupyter, it is %USERPROFILE%/.jupyter.
I read various threads about jupyter invoke, in particular:
this large thread suggests jupyter notebook will behave differently in cmd.exe and Anaconda prompt, without further details though
Problems with configuring Jupyter start directory addresses an issue with Windows shortcut, similar to this Windows app start steps
this post proposes wrapping --notebook-dir="." key into a .bat file
My other thought is that %USERPROFILE% with non-Latin character is not be recongnisable by jupyter, but %USERPROFILE%/.jupyter is empty anyways.
You must generate the configuration of Jupyter.
jupyter notebook --generate-config
Navigate to your folder and the folder .jupyter (C:\Users\%username%\.jupyter)
You will find a file called jupyter_notebook_config.py
Edit it with notepad++ for exemple and locate c.NotebookApp.notebook_dir
Between ' ' put the path you want. For exemple :
c.NotebookApp.notebook_dir = 'C:/Users/Евгений/Documents/GitHub/sandbox'
Save it and start Jupyter without specifying a path
Be careful, the characters in your username may be a problem.
Keep me informed.
Use the jupyter notebook config file:
Open cmd (or Anaconda Prompt) and run jupyter notebook --generate-config.
This writes a file to C:\Users\username\.jupyter\jupyter_notebook_config.py.
Browse to the file location and open it in an Editor
Search for the following line in the file: #c.NotebookApp.notebook_dir = ''
Replace by c.NotebookApp.notebook_dir = 'D:/git'
Make sure you use forward slashes in your path
Remove the # at the beginning of the line to allow the line to execute
Using docker and the images maintained by the Jupyter team:
docker run -v `pwd`:/home/jovyan -p 8890:8888 jupyter/scipy-notebook

execution error when opening Jupyter notebook through terminal

I install Jupyter notebook with anaconda, and then to open Jupyter notebook in iterm2 on my Mac. However, some error occurs:
[I 23:55:35.354 NotebookApp] 0 active kernels
[I 23:55:35.354 NotebookApp] The Jupyter Notebook is running at:http://localhost:8888/? token=cd4638d30319d5e08fc7aebf56f395e5e3b88967c82798a3
[I 23:55:35.354 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 23:55:35.364 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=cd4638d30319d5e08fc7aebf56f395e5e3b88967c82798a3
0:97: execution error: “"http://localhost:8888/tree?token=6ff6e52b1c221edfae2dede83f5cdc282959679ee4c5e3a5"”不理解“open location”信息。 (-1708)
The Chinese information at last means' can't understand the information of 'open location''.
Who can help me to settle this, thanks.
ps. If I input the address in safari, I can get in the page of Jupyter notebook and use it without any problem. But why couldn't I open Jupiter notebook through the terminal?

ipython notebook command in anaconda opens jupyter notebook?

The following is the command and the result.
[Anaconda2] C:\Users\Gurminder>ipython notebook
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook`... continue in 5 sec. Press Ctrl-C to quit now.
[I 17:56:25.760 NotebookApp] Serving notebooks from local directory: C:\Users\Gurminder
[I 17:56:25.763 NotebookApp] 0 active kernels
[I 17:56:25.763 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 17:56:25.766 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
And the display on the browser looks like following:
Why is it launching jupyter when I am giving the command to launch ipython.
I have updated all the packages including ipython.
The answer is on the IPython website:
IPython is a growing project, with increasingly language-agnostic
components. IPython 3.x was the last monolithic release of IPython,
containing the notebook server, qtconsole, etc. As of IPython 4.0, the
language-agnostic parts of the project: the notebook format, message
protocol, qtconsole, notebook web application, etc. have moved to new
projects under the name Jupyter. IPython itself is focused on
interactive Python, part of which is providing a Python kernel for
Jupyter.
In summary, what previously was known as the IPython notebook now is the Jupyter notebook. Apart from the name, they are practically the same.
It even says so in the warning message you get:
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook`... continue in 5 sec. Press Ctrl-C to quit now.
ipython notebook is deprecated and you should use jupyter notebook instead, but IPython plays nice and runs the Jupyter notebook for you.

Resources