Can't run Jupyter Notebook

Answered

I am using the latest version of Conda and Pycharm as of Today sept, 2017. I have conda in my path and I get the following error: 

[E 03:58:49.662 NotebookApp] [nb_conda_kernels] couldn't call conda:
[Errno 2] No such file or directory: 'conda'
[I 03:58:49.663 NotebookApp] [nb_conda_kernels] enabled, 0 kernels found
[I 03:58:50.057 NotebookApp] [nb_anacondacloud] enabled
[I 03:58:50.062 NotebookApp] [nb_conda] enabled
[I 03:58:50.100 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 03:58:50.100 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named 'nbbrowserpdf'
[I 03:58:50.105 NotebookApp] Serving notebooks from local directory: /Users/taha_raslan/PycharmProjects/vision
[I 03:58:50.105 NotebookApp] 0 active kernels
[I 03:58:50.105 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=ebebb7fda2ec3c89ef9a35f4d42c35dcb7af5ee74eab4965
[I 03:58:50.105 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 03:58:50.106 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=ebebb7fda2ec3c89ef9a35f4d42c35dcb7af5ee74eab4965
[I 03:58:51.017 NotebookApp] 302 GET / (127.0.0.1) 2.10ms
[I 03:58:51.019 NotebookApp] 302 GET /tree? (127.0.0.1) 0.91ms
[I 03:58:51.082 NotebookApp] Kernel started: 21808556-b52e-45fc-b0f5-cda35e78303d
[W 03:58:51.087 NotebookApp] No session ID specified
/usr/bin/python: No module named ipykernel_launcher
[I 03:58:54.085 NotebookApp] KernelRestarter: restarting kernel (1/5)
/usr/bin/python: No module named ipykernel_launcher
[I 03:58:57.095 NotebookApp] KernelRestarter: restarting kernel (2/5)
/usr/bin/python: No module named ipykernel_launcher
[I 03:59:00.109 NotebookApp] KernelRestarter: restarting kernel (3/5)
/usr/bin/python: No module named ipykernel_launcher
[W 03:59:01.089 NotebookApp] Timeout waiting for kernel_info reply from 21808556-b52e-45fc-b0f5-cda35e78303d
[I 03:59:03.118 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 21808556-b52e-45fc-b0f5-cda35e78303d restarted
/usr/bin/python: No module named ipykernel_launcher
[W 03:59:06.128 NotebookApp] KernelRestarter: restart failed
[W 03:59:06.129 NotebookApp] Kernel 21808556-b52e-45fc-b0f5-cda35e78303d died, removing from map.
ERROR:root:kernel 21808556-b52e-45fc-b0f5-cda35e78303d restarted failed!

13 comments

Hi Raslan! What project interpreter do you have selected in PyCharm settings? Settings | Project | Project Interpreter

0

Hi. Thanks for your reply. Its "anaconda/bin/python3"

0

I see, thank you! Could you please reinstall kernel with:

python -m pip uninstall ipykernel
python -m pip install ipykernel
0

I tried this and it's not working. 

0

Hm, are you able to run notebook from terminal outside of PyCharm with

jupyter notebook

command?

0

Yes. I am. 

 

I think the problem is in 4 things: 

 

1-Pycharm can't call Conda: " [nb_conda_kernels] couldn't call conda"

 

2-"[Errno 2] No such file or directory: 'conda'"

 

3-It uses the regular Python rather than conda and it doesn't see ipykernel: "/usr/bin/python: No module named ipykernel_launcher"

0

Also, when I run any cell, this is the first thing I get before all the errors:

 

"/Users/my_username/anaconda/bin/python3 /Users/my_username/anaconda/bin/jupyter-notebook --no-browser --ip localhost --port 8888"

 

Here, I see it calls 2 anaconda. 

0

Same issue here. Even following the step by step guide won't work for me.

The cell does not run in PyCharm. However, when I open the same URL in the web browser, everything goes fine.

0

Reverted back to PyCharm 2017.1.5 from latest 2.3 and it worked for me. So I believe it is a regression in the new version.

0

Raslan, there should be auto created run configuration for notebook, please check if it has correct interpreter selected:

1

Wei Wang is right on!

 

I had to regress back to Pycharm 1017.1.5 to get it to work at all. 

I would like to ask how do we alter the fonts and backgrounds of the output, I am not a huge fan of Times New Roman font.... :)

0

I am using PyCharm Community 2018.1 and I have exactly the same problem. I can start a Jupyter Notebook from inside PyCharm and this is configured to use my project's virtual environment but when I try to run any cell I kept getting

<wrong python venv>/bin/python: No module named ipykernel_launcher"

It turns out that because I had two python virtualenvs it was running the notebook kernel from the wrong venv. Normally, when I run a notebook in the browser and say "new notebook" it gives me a choice for which kernel to use.

Anyway, to fix my problem I simply deleted the other kernel in ~/.local/share/jupyter/kernels/  and now it works fine!

 

0

So is there a way to tell pycharm to use a particular jupyter kernel config?  
If  I have $HOME/.local/share/jupyter/kernels/project/kernel.json,   pycharm doesn't seem to find it,
but if I copy the project directory to python3, it finds $HOME/.local/share/jupyter/kernels/python3/kernel.json

I would like to use project/kernel.json

0

Please sign in to leave a comment.