Notebook: %load_ext rpy2.ipython raises dead kernel

Created on 18 Oct 2016  路  10Comments  路  Source: jupyter/notebook

Whenever to run the cell with only %load_ext rpy2.ipython in it will result in the dead kernel, which can restart automatically.

I have no ideas at all. How to diagnose it?

Needs Info Environment

Most helpful comment

Hi--I don't know if I had the same problem as ghost, but it had the same symptoms: kernel of my Jupyter Notebook reproducibly died when I tried to execute %load_ext rpy2.ipython. I tried Carreau's suggestion of running the command in the pure IPython terminal, and found I got no error message at all--worked flawlessly. After a bit more digging, I determined the issue was apparently due to interaction with miniconda environments: in the error condition, I had started the Jupyter Notebook server in the root conda environment, then used the new Jupyter Notebook kernel selection functionality to choose the python install in the conda environment for my particular project. When run that way, the kernel died every time when I tried to load the rpy2.ipython extension. However, when I sourced the miniconda environment for my project in a terminal window and worked from within the environment (either directly in the IPython terminal, or by starting the Jupyter Notebook server from within that environment), the %load_ext rpy2.ipython command worked just fine.

All 10 comments

Are there any error messages in the terminal where you started the notebook?

@takluyver
Here are part of messages in the terminal:

[E 20:26:09.871 NotebookApp] Exception restarting kernel
    Traceback (most recent call last):
      File "/Users/xuliucheng/anaconda/lib/python3.5/site-packages/notebook/services/kernels/handlers.py", line 88, in post
        yield gen.maybe_future(km.restart_kernel(kernel_id))
      File "/Users/xuliucheng/anaconda/lib/python3.5/site-packages/notebook/services/kernels/kernelmanager.py", line 109, in restart_kernel
        self._check_kernel_id(kernel_id)
      File "/Users/xuliucheng/anaconda/lib/python3.5/site-packages/notebook/services/kernels/kernelmanager.py", line 169, in _check_kernel_id
        raise web.HTTPError(404, u'Kernel does not exist: %s' % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e0a94bef-0287-4f37-8249-c82250c96200)
[E 20:26:09.873 NotebookApp] {
      "Host": "localhost:8888",
      "Accept-Language": "zh-CN,zh;q=0.8,en;q=0.6",
      "Accept": "application/json, text/javascript, */*; q=0.01",
      "Referer": "http://localhost:8888/notebooks/Downloads/TestingRpy2.ipynb",
      "Origin": "http://localhost:8888",
      "Content-Length": "0",
      "Accept-Encoding": "gzip, deflate",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
      "X-Requested-With": "XMLHttpRequest",
      "Connection": "keep-alive"
    }
[E 20:26:09.873 NotebookApp] 500 POST /api/kernels/e0a94bef-0287-4f37-8249-c82250c96200/restart (::1) 2.51ms referer=http://localhost:8888/notebooks/Downloads/TestingRpy2.ipynb

Here is the ipython file.

I run the cells again and it didn't lead to the lead kernel this time, but notebook does not work as expected at the sametime. The output of whole cells is nothing.

Hmm, nothing about that really says what's going on. The only thing I can suggest is that you try uninstalling rpy2 and installing it again.

I reinstalled rpy2. Unfortnately, the problem is still there.

Could the following messges imply anything? @takluyver

$ jupyter notebook
[W 21:22:34.621 NotebookApp] Unrecognized JSON config file version, assuming version 1
[W 21:22:34.626 NotebookApp] Collisions detected in jupyter_notebook_config.py and jupyter_notebook_config.json config files. jupyter_notebook_config.json has higher priority: {
      "NotebookApp": {
        "nbserver_extensions": "{'nb_anacondacloud': True, 'nbpresent': True, 'nb_conda': True} ignored, using {'jupyter_nbextensions_configurator': True}"
      }
    }
[I 21:22:35.749 NotebookApp] [nb_conda_kernels] enabled, 4 kernels found
[I 21:22:35.879 NotebookApp] Loaded extension jupyter_nbextensions_configurator
[I 21:22:35.906 NotebookApp] Serving notebooks from local directory: /Users/xuliucheng
[I 21:22:35.906 NotebookApp] 0 active kernels
[I 21:22:35.906 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 21:22:35.906 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 21:22:49.778 NotebookApp] Kernel started: 6d29fcd4-4b23-4071-aa83-7f65f983aa05
[W 21:22:49.815 NotebookApp] 404 GET /kernelspecs/Python%20[tensorflow]/logo-64x64.png (::1) 27.61ms referer=http://localhost:8888/notebooks/pelican-blog/content/Untitled2.ipynb
[W 21:22:50.142 NotebookApp] 404 GET /notebooks/pelican-blog/content/biblio.bib (::1): No such file or directory: pelican-blog/content/biblio.bib
[W 21:22:50.144 NotebookApp] 404 GET /notebooks/pelican-blog/content/biblio.bib (::1) 3.28ms referer=http://localhost:8888/notebooks/pelican-blog/content/Untitled2.ipynb
[I 21:22:58.779 NotebookApp] KernelRestarter: restarting kernel (1/5)
WARNING:root:kernel 6d29fcd4-4b23-4071-aa83-7f65f983aa05 restarted
[W 21:23:03.572 NotebookApp] 404 GET /api/kernels/1d66ab3a-f88f-47dd-8187-0a5b824c3c71/channels?session_id=A18AE3B994A6497CA99EF6A6C70F348B (::1): Kernel does not exist: 1d66ab3a-f88f-47dd-8187-0a5b824c3c71
[W 21:23:03.574 NotebookApp] 404 GET /api/kernels/1d66ab3a-f88f-47dd-8187-0a5b824c3c71/channels?session_id=A18AE3B994A6497CA99EF6A6C70F348B (::1) 6.49ms referer=None
[I 21:23:04.790 NotebookApp] KernelRestarter: restarting kernel (1/5)
WARNING:root:kernel 6d29fcd4-4b23-4071-aa83-7f65f983aa05 restarted
[I 21:23:16.801 NotebookApp] KernelRestarter: restarting kernel (1/5)
WARNING:root:kernel 6d29fcd4-4b23-4071-aa83-7f65f983aa05 restarted

Sorry, that doesn't really contain any hints either.

@Carreau I know you did some very interesting cross-language experiments. Have you used rpy2.ipython before? Any suggestions?

Hum, this is likely a dynamic library issue. I would try running %load_ext rpy2.ipython in pure IPython terminal to get a better error message. I had to change my dynamic library LDPATH on my computer but I never had a segfault.

Hi--I don't know if I had the same problem as ghost, but it had the same symptoms: kernel of my Jupyter Notebook reproducibly died when I tried to execute %load_ext rpy2.ipython. I tried Carreau's suggestion of running the command in the pure IPython terminal, and found I got no error message at all--worked flawlessly. After a bit more digging, I determined the issue was apparently due to interaction with miniconda environments: in the error condition, I had started the Jupyter Notebook server in the root conda environment, then used the new Jupyter Notebook kernel selection functionality to choose the python install in the conda environment for my particular project. When run that way, the kernel died every time when I tried to load the rpy2.ipython extension. However, when I sourced the miniconda environment for my project in a terminal window and worked from within the environment (either directly in the IPython terminal, or by starting the Jupyter Notebook server from within that environment), the %load_ext rpy2.ipython command worked just fine.

Yeah, don't use the conda nbkernel extension it sets up environment only for the running Python kernel, so some things wont work. You'll have to install the kernel spec from within the environment.

Thanks @AmandaBirmingham, your suggestion solves this issue for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ehossain1982 picture ehossain1982  路  3Comments

cmesro picture cmesro  路  3Comments

qnicole-zakka picture qnicole-zakka  路  3Comments

itoed picture itoed  路  3Comments

mowe96 picture mowe96  路  3Comments