jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.69k stars 4.93k forks source link

kernel error #1171

Open haihan-yu opened 8 years ago

haihan-yu commented 8 years ago

I used conda install jupyter to install without a problem. Then I open the jupyter notebook, kernel error appears. I also use python -m IPython kernelspec install-self to reinstall kernel, but it cannot solve the problem


Traceback (most recent call last):
  File "//anaconda/lib/python2.7/site-packages/notebook/base/handlers.py", line 458, in wrapper
    result = yield gen.maybe_future(method(self, *args, **kwargs))
  File "//anaconda/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "//anaconda/lib/python2.7/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "//anaconda/lib/python2.7/site-packages/tornado/gen.py", line 1014, in run
    yielded = self.gen.throw(*exc_info)
  File "//anaconda/lib/python2.7/site-packages/notebook/services/sessions/handlers.py", line 58, in post
    sm.create_session(path=path, kernel_name=kernel_name))
  File "//anaconda/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "//anaconda/lib/python2.7/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "//anaconda/lib/python2.7/site-packages/tornado/gen.py", line 1014, in run
    yielded = self.gen.throw(*exc_info)
  File "//anaconda/lib/python2.7/site-packages/notebook/services/sessions/sessionmanager.py", line 73, in create_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "//anaconda/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "//anaconda/lib/python2.7/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "//anaconda/lib/python2.7/site-packages/tornado/gen.py", line 282, in wrapper
    yielded = next(result)
  File "//anaconda/lib/python2.7/site-packages/notebook/services/kernels/kernelmanager.py", line 87, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "//anaconda/lib/python2.7/site-packages/jupyter_client/multikernelmanager.py", line 109, in start_kernel
    km.start_kernel(**kwargs)
  File "//anaconda/lib/python2.7/site-packages/jupyter_client/manager.py", line 244, in start_kernel
    **kw)
  File "//anaconda/lib/python2.7/site-packages/jupyter_client/manager.py", line 190, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "//anaconda/lib/python2.7/site-packages/jupyter_client/launcher.py", line 123, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "//anaconda/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "//anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
minrk commented 8 years ago

What do you get from jupyter kernelspec list?

haihan-yu commented 8 years ago

Hello, this is what I got, thanks! jupyter kernelspec list Available kernels: julia-0.3 /Users/haihan/Library/Jupyter/kernels/julia-0.3 python2 /Users/haihan/Library/Jupyter/kernels/python2

takluyver commented 8 years ago

Have a look in /Users/haihan/Library/Jupyter/kernels/python2/kernel.json. The first value in argv should be the path to a Python interpreter. What path has it got?

haihan-yu commented 8 years ago

Hello, thanks for your replies. the first argv is "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python", thanks a lot!

ronteo commented 8 years ago

I had the same issue resolved it by running python2 -m ipykernel install --user

chisoo commented 7 years ago

@ronteo I had the same issue and this fixed it. Thanks!

ronteo commented 7 years ago

@chisoo You are very welcome. Glad it worked!

foarruda commented 7 years ago

@ronteo this fixed my jupyter too. Thanks a lot!!

aulon commented 7 years ago

I have the same issue.

After I check the argv path in my kernel.json what should I do?

Running jupyter kernelspec list gives me /home/aulon/.local/share/jupyter/kernels/python2,

but the argv value is /usr/bin/python2.

I tried replacing argv with /home/aulon/.local/share/jupyter/kernels/python2 and still the same error.

I feel like I am missing a database.

[W 06:54:04.215 NotebookApp] The signatures database cannot be opened; maybe it is corrupted or encrypted. You may need to rerun your notebooks to ensure that they are trusted to run Javascript. The old signatures database has been renamed to /home/aulon/.local/share/jupyter/nbsignatures.db.bak and a new one has been created.
[E 06:54:04.218 NotebookApp] Unhandled error in API request
    Traceback (most recent call last):
      File "/home/aulon/.local/lib/python2.7/site-packages/notebook/base/handlers.py", line 516, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "/home/aulon/.local/lib/python2.7/site-packages/tornado/gen.py", line 1055, in run
        value = future.result()
      File "/home/aulon/.local/lib/python2.7/site-packages/tornado/concurrent.py", line 238, in result
        raise_exc_info(self._exc_info)
      File "/home/aulon/.local/lib/python2.7/site-packages/tornado/gen.py", line 307, in wrapper
        yielded = next(result)
      File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/handlers.py", line 124, in get
        path=path, type=type, format=format, content=content,
      File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/filemanager.py", line 384, in get
        model = self._notebook_model(path, content=content)
      File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/filemanager.py", line 344, in _notebook_model
        self.mark_trusted_cells(nb, path)
      File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/manager.py", line 456, in mark_trusted_cells
        trusted = self.notary.check_signature(nb)
      File "/home/aulon/.local/lib/python2.7/site-packages/traitlets/traitlets.py", line 556, in __get__
        return self.get(obj, cls)
      File "/home/aulon/.local/lib/python2.7/site-packages/traitlets/traitlets.py", line 535, in get
        value = self._validate(obj, dynamic_default())
      File "/home/aulon/.local/lib/python2.7/site-packages/notebook/services/contents/manager.py", line 58, in _notary_default
        return sign.NotebookNotary(parent=self)
      File "/home/aulon/.local/lib/python2.7/site-packages/nbformat/sign.py", line 390, in __init__
        self.store = self.store_factory()
      File "/home/aulon/.local/lib/python2.7/site-packages/nbformat/sign.py", line 338, in factory
        return SQLiteSignatureStore(self.db_file)
      File "/home/aulon/.local/lib/python2.7/site-packages/nbformat/sign.py", line 147, in __init__
        self.db = self._connect_db(db_file)
      File "/home/aulon/.local/lib/python2.7/site-packages/nbformat/sign.py", line 171, in _connect_db
        os.rename(db_file, old_db_location)
    OSError: [Errno 2] No such file or directory
...

@takluyver please, what do you suggest?

quoniammm commented 7 years ago

Thanks

saxenaPAWAN commented 6 years ago

For Anaconnda users issue can be fixed by changing python.exe to pythonw.exe

superghm commented 6 years ago

For Anaconnda users issue can be fixed by changing python.exe to pythonw.exe

@saxenaPAWAN worked like a charm! Thank you!