Comments (42)
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
from ipykernel.
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
from ipykernel.
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. 😀
from ipykernel.
Yup, install that...
I wonder if you have an old version of pip - try running:
pip install --upgrade setuptools pip
from ipykernel.
@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
from ipykernel.
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.
from ipykernel.
logconfig is a bit weird, since that's not part of ipykernel or anything ipykernel imports, to my knowledge. Can you start notebooks in a different directory?
from ipykernel.
@sorrelh what do you get from /usr/bin/python -V
and /usr/bin/python -m pip list
?
from ipykernel.
...and /usr/bin/python -m IPython --version
from ipykernel.
I ran into the same problem multiple times. It seems that it stems from the fact that I had ipython installed through both apt and pip.
from ipykernel.
Thanks, I think apt and setuptools frequently confuse each other. It's unfortunate how often this happens.
from ipykernel.
I am having the same problem. I installed Python 2.7 using Anaconda, and can run Jupyter notebook with no problems.
I just used Anaconda to make a new, concurrent, Python 3.5 installation along with Jupyter (I went through the correct procedure for maintaining the two versions of Python at once), and I receive an error when opening a notebook using the 3.5-kernel.
C:\Anaconda\envs\py35\python.exe: Error while finding spec for 'ipykernel.__main __' (<class 'ImportError'>: DLL load failed: The specified module could not be f ound.); 'ipykernel' is a package and cannot be directly executed
from ipykernel.
I have the same issue now. Don't know how to solve..
from ipykernel.
I have an io
sub package in one of my projects. As soon as I created that folder ipython went crazy. I could fix it by renaming the package/folder
from ipykernel.
I have a similar problem, but in my case the import error is with decorator.
Is a new virtualenv instalation with python 3.4.3.
Any idea to solve this?
[I 04:13:00.279 NotebookApp] Kernel started: dd3938af-5112-4158-87b6-a93a41fdcc9a
/home/nanofix/repository/.sigmavenv/bin/python: Error while finding spec for 'ipykernel.main' (<class 'ImportError'>: cannot import name 'decorator'); 'ipykernel' is a package and cannot be directly executed
[I 04:13:03.282 NotebookApp] KernelRestarter: restarting kernel (1/5)
/home/nanofix/repository/.sigmavenv/bin/python: Error while finding spec for 'ipykernel.main' (<class 'ImportError'>: cannot import name 'decorator'); 'ipykernel' is a package and cannot be directly executed
[I 04:13:06.295 NotebookApp] KernelRestarter: restarting kernel (2/5)
/home/nanofix/repository/.sigmavenv/bin/python: Error while finding spec for 'ipykernel.main' (<class 'ImportError'>: cannot import name 'decorator'); 'ipykernel' is a package and cannot be directly executed
[I 04:13:09.317 NotebookApp] KernelRestarter: restarting kernel (3/5)
/home/nanofix/repository/.sigmavenv/bin/python: Error while finding spec for 'ipykernel.main' (<class 'ImportError'>: cannot import name 'decorator'); 'ipykernel' is a package and cannot be directly executed
[W 04:13:10.368 NotebookApp] Timeout waiting for kernel_info reply from dd3938af-5112-4158-87b6-a93a41fdcc9a
[I 04:13:12.329 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel dd3938af-5112-4158-87b6-a93a41fdcc9a restarted
/home/nanofix/repository/.sigmavenv/bin/python: Error while finding spec for 'ipykernel.main' (<class 'ImportError'>: cannot import name 'decorator'); 'ipykernel' is a package and cannot be directly executed
[W 04:13:15.348 NotebookApp] KernelRestarter: restart failed
from ipykernel.
@ellisonbg does pip install decorator
solve it? What do you see in pip list
?
from ipykernel.
I create a new virtualenv and reinstall. Now works!!!
from ipykernel.
I had the same problem -- turned out it was because I had a file in the same folder written in Python 2 (when my ipython notebook was running Python 3). Changing the extension of that file to .txt fixed the issue for me.
from ipykernel.
Seems I hit the same issue because I'd re-initialised a Python 2.7 virtualenv with Python 3.5. Starting from a clean virtualenv solved the issue.
from ipykernel.
I'm having a similar problem after having to install with pip.
Error while finding spec for 'ipykernel.__main__' (<class 'ImportError'>: No module named 'path'
Unfortunately, pip doesn't know what I'm talking about when I ask it to install something called path
.
If there are known issues with installing matplotlib etc. before ipython notebook, it would be great if someone would write those up with the recommended order of installation. I'd prefer to use anaconda, but in this case I don't have that option.
from ipykernel.
from ipykernel.
Hi, I'm having a similar problem with Jupyter 4.1.0. Specifically:
//anaconda/bin/python: cannot import name decorator; 'ipykernel' is a package and cannot be directly executed
I noticed @minrk comment:
Can you start notebooks in a different directory?
So I tired in a different directory and it is working without any (re)installation or upgrades. @minrk what did you suspect when you wrote that originally?
from ipykernel.
@cranmer a decorator.py
file in the CWD (or any of many other module names that are imported) will prevent it from starting.
from ipykernel.
Having the same issue I had installed new ipywidgets and then went into a spiral, did my best to nuke all prior installations since I've been using this stuff so long figured the upgrade combinations had finally hit me so I cleaned house and now I have Jupyter up and going via P3 and the p3 kernel is fine but my p2 kernel won't start. fwiw I did also uninstall and reinstall the ipywidgets and started to get errors on the nbextensions not being found (yet they are working) so far I'm not seeing the widgets, but that is a different issue.
I have verified that path.py is installed for p2..
given the above note from @minrk I tried starting the notebook in the next directory level down, same thing:
So anyhow I'm left with this when trying to start a P2 notebook:
KernelRestarter: restarting kernel (3/5)
/usr/bin/python2: No module named paths; 'ipykernel' is a package and cannot be directly executed
Grrrrr....
from ipykernel.
No module named paths
This message typically means it's finding an older version of the IPython
package to import. If you have IPython installed through something like apt, you might want to uninstall that, and make sure that you have the latest version of IPython installed through pip.
from ipykernel.
No module named IPython.core.profiledir
😕 Don't know about that one, sorry. I'd suggest trying to work out where it thinks it's importing IPython from - there might be a broken install lying around somewhere.
from ipykernel.
somehow I seem to have broken ipython (2) quite completely, any ideas how to start over? If I even just try to start ipython from the command prompt I get:
tom@tom-sam:~$ ipython
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 7, in <module>
from IPython import start_ipython
..... and at the end
from .traitlets import *
File "/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.py", line 56, in <module>
from ipython_genutils import py3compat
ImportError: No module named ipython_genutils
And I have checked to see if they are installed via pip and they claim to be yet also if I start the interpeter i cannot import ipython (no such module)
Any ideas? where how to fix?
from ipykernel.
What's the shebang (#!...
) in /usr/local/bin/ipython
? WIth that Python, try running path/to/python -m pip list
. Also, if you have $PYTHONPATH set, unset it.
from ipykernel.
I have not directly accessed $PYTHONPATH (don't directly know how!)
The shebang line was:
tom@tom-sam:~$ /usr/bin/python -m pip list
gives me same as from main prompt and shows among the rest:
ipykernel (4.3.1)
ipython (4.2.0, /usr/local/lib/python2.7/dist-packages)
from ipykernel.
is this an issue?
>>> import os
>>> os.environ['PYTHONPATH']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'PYTHONPATH'
from ipykernel.
No, that's fine, PYTHONPATH generally shouldn't be present unless you know you need it. I was checking that it wasn't set.
Does the list pip gives you also include ipython_genutils
? If not, pip install that.
from ipykernel.
Weird pip list did not show it I did pip install, it said requirement already satisfied, did pip unintsall, it did a bunch the reinstalled no pip list shows it. now Ipython starts from command line (improvement but new error message on Jupyter
/usr/bin/python2: No module named jupyter_client; 'ipykernel' is a package and cannot be directly executed
So maybe install that?
from ipykernel.
Ok I'm almost there I ended up installing pip install jupyter, now the jupyter shebang in bin points at python (which is python 2) the remaining jupyter files in bin are set to p3 I did run pip3 install jupyter after the pip install, hoping that would fix what gets executed from the command line? it seems the whole mess related to confusion between the two installations? both p2 and p3 kernels are running but I'm back to errors in the console... which don't seem to be hurting but still....
from ipykernel.
You shouldn't need jupyter
installed for both. The idea is that you install jupyter
for one (preferably Python 3), and then just install ipykernel
and its dependencies to provide the kernel for Python 2.
The jupyter
command is provided by the package jupyter_core
, so if you'd rather that pointed to Python 3, remove and reinstall that package with pip3.
from ipykernel.
Well I was getting an error message from p2 start up complaining about other jupyter components after I fixed Jupyter-client which was why I went ahead with installing core... it "seems notebook running with p3 that is where the shebang for that points..
from ipykernel.
Rats, you're right, the jupyter_core
package is required for ipykernel, but that creates the jupyter command, even when there's nothing for it to do.
from ipykernel.
so... solution? and I guess open bug? not real sure what is running what given the mix of p2/p3 components in bin...
from ipykernel.
Opened jupyter/jupyter_core#76 about it. I don't think it should interfere with what you're trying to do, though. The notebook server should still be running on Python 3, it's just extra confusing.
from ipykernel.
Thanks so much! whew! I suspect it may be involved with some of the other misc errors? but strange though.. for the time being, I'm good!
from ipykernel.
Been having the same dead kernel issue when launching jupyter notebook. pip install "ipython[notebook]" --upgrade resolves my issue
from ipykernel.
Having the same issue and still don't know how to fix yet.
I followed the steps here, Step 1 goes fine, but Step 2 gives an error:
/usr/bin/python3: Error while finding spec for 'ipykernel.__main__' (<class 'TypeError'>: __call__() missing 1 required positional argument: 'name'); 'ipykernel' is a package and cannot be directly executed
from ipykernel.
Hi all,
I kind of have the same problem when I try to start a root notebook with C++ kernel. The output I get is the following:
KernelRestarter: restarting kernel (2/5)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named ROOT
I would be grateful for any kind of help!
from ipykernel.
Related Issues (20)
- jupyther
- Should ipykernel align kernel SVG with the one used by JupyterLab?
- CI failing with INTERNALERROR when skipping tests
- Jupyter notebook cell instruction after asyncio.run is not executing with 6.28.0v of ipykernel HOT 4
- Can not install ipykernel HOT 2
- Better cell magic by removing some of the syntax limitations
- python 3.11 debugpy error messages HOT 3
- Directing output of out external threads/processes to specific cells HOT 1
- Qt eventloop interferes with asyncio.call_later in _abort_queues HOT 7
- Incorrect stack traceback when try except finally is used in jupyter notebooks with pandas
- Feature request: enable editing_mode = ‘vi’ for a ZMQTerminalIPythonApp console
- TypeError: '>=' not supported between instances of 'str' and 'datetime.datetime' HOT 3
- Release 7.0 HOT 5
- "ModuleNotFoundError: No module named 'comm'" when running 'python -m ipykernel install'
- Output [ ] Alone HOT 2
- Compatibility with pytest 8 HOT 1
- Different child termination behavior during Kernel shutdown on Posix and Windows systems HOT 1
- Windows: ipykernel install prefix not usable for c:\programdata\jupyter
- AnyIO commit breaks Matplotlib display in separate windows HOT 2
- Restore to previous state with copy-on-write HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipykernel.