ipykernel: Unable to run kernel

When I try to open a notebook using the Python 3 kernel, I get the following output.

[I 12:29:22.834 NotebookApp] Kernel started: 5e226817-b874-4f6c-9573-be8bcc723690
/data/tmacey/.virtualenvs/data-analytics/bin/python: Error while finding spec for 'ipykernel.__main__' (<class 'ImportError'>: No module named 'logconfig'); 'ipykernel' is a package and cannot be directly executed
[I 12:29:25.834 NotebookApp] KernelRestarter: restarting kernel (1/5)
/data/tmacey/.virtualenvs/data-analytics/bin/python: Error while finding spec for 'ipykernel.__main__' (<class 'ImportError'>: No module named 'logconfig'); 'ipykernel' is a package and cannot be directly executed
[I 12:29:28.840 NotebookApp] KernelRestarter: restarting kernel (2/5)
/data/tmacey/.virtualenvs/data-analytics/bin/python: Error while finding spec for 'ipykernel.__main__' (<class 'ImportError'>: No module named 'logconfig'); 'ipykernel' is a package and cannot be directly executed
[I 12:29:31.843 NotebookApp] KernelRestarter: restarting kernel (3/5)
/data/tmacey/.virtualenvs/data-analytics/bin/python: Error while finding spec for 'ipykernel.__main__' (<class 'ImportError'>: No module named 'logconfig'); 'ipykernel' is a package and cannot be directly executed
[W 12:29:33.487 NotebookApp] Timeout waiting for kernel_info reply from 5e226817-b874-4f6c-9573-be8bcc723690
[I 12:29:34.846 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 5e226817-b874-4f6c-9573-be8bcc723690 restarted
/data/tmacey/.virtualenvs/data-analytics/bin/python: Error while finding spec for 'ipykernel.__main__' (<class 'ImportError'>: No module named 'logconfig'); 'ipykernel' is a package and cannot be directly executed
[W 12:29:37.852 NotebookApp] KernelRestarter: restart failed
[W 12:29:37.852 NotebookApp] Kernel 5e226817-b874-4f6c-9573-be8bcc723690 died, removing from map.
ERROR:root:kernel 5e226817-b874-4f6c-9573-be8bcc723690 restarted failed!
[W 12:29:37.863 NotebookApp] Kernel deleted before session
[W 12:29:37.864 NotebookApp] 410 DELETE /api/sessions/d8d3f8c2-1fdc-4d5d-b52d-07afb925587b (::1) 1.70ms referer=http://localhost:8888/notebooks/Untitled.ipynb

I am using IPython, Jupyter and ipykernel v4.0.3 with Python 3.4.3 on Linux. Linux kommandcenter 4.1.5-1-MANJARO #1 SMP PREEMPT Tue Aug 11 05:14:23 UTC 2015 x86_64 GNU/Linux

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 42 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same problem after installing matplotlib. I had to uninstall both matplotlib and ipython/ipython notebooks, and reinstall with pip install "ipython[notebook]" --upgrade

I had the same error, using Python v3.4.3 with Jupyter (v4.x) on Ubuntu GNU/Linux. Error while finding spec for 'ipykernel.__main__' (<class 'ImportError'>: cannot import name 'decorator'); 'ipykernel' is a package and cannot be directly executed

I couldn’t solve this problem, but then I noticed that, in the same folder I was running jupyter notebook, I had a file called decorator.py. Therefore, I renamed it to something else for avoiding name conflicts. And now it works. 😀

I’m getting a similar thing without reference to logconfig:

[I 07:44:58.408 NotebookApp] Kernel started: a86335f9-0361-4f29-9acc-e9279ebcd84a
/usr/bin/python: cannot import name path; 'ipykernel' is a package and cannot be directly executed
[I 07:45:01.410 NotebookApp] KernelRestarter: restarting kernel (1/5)
/usr/bin/python: cannot import name path; 'ipykernel' is a package and cannot be directly executed
[I 07:45:04.420 NotebookApp] KernelRestarter: restarting kernel (2/5)
/usr/bin/python: cannot import name path; 'ipykernel' is a package and cannot be directly executed
[I 07:45:07.428 NotebookApp] KernelRestarter: restarting kernel (3/5)
/usr/bin/python: cannot import name path; 'ipykernel' is a package and cannot be directly executed
[W 07:45:08.492 NotebookApp] Timeout waiting for kernel_info reply from a86335f9-0361-4f29-9acc-e9279ebcd84a
[I 07:45:10.438 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel a86335f9-0361-4f29-9acc-e9279ebcd84a restarted
/usr/bin/python: cannot import name path; 'ipykernel' is a package and cannot be directly executed
[W 07:45:13.451 NotebookApp] KernelRestarter: restart failed
[W 07:45:13.451 NotebookApp] Kernel a86335f9-0361-4f29-9acc-e9279ebcd84a died, removing from map.

Update: mine seems to have been caused by an old system ipython package from Ubuntu and worked after removing all the old ipython/ipython-notebook packages and reinstalling them via pip

Yup, install that…

I wonder if you have an old version of pip - try running:

pip install --upgrade setuptools pip

How I fixed it!

I had made a custom package called io in the directory from where I was starting my Jupyter notebook. I removed that io package and the problem got resolved.

Check if you have any packages in the folder from where you are starting your jupyter notebook.

@takluyver Thanks for following me through this travale…I did remove the system installed Ipython via APT I also reinstalled using:

tom@tom-sam:~$ sudo python2 -m pip install ipykernel
tom@tom-sam:~$ sudo python2 -m ipykernel install
Installed kernelspec python2 in /usr/local/share/jupyter/kernels/python2

and that changed the error message for the p2 kernel to

/usr/bin/python2: No module named IPython.core.profiledir; 'ipykernel' is a package and cannot be directly executed