4

I installed python using the Anaconda installer and am happily using the version of Jupyter that comes with it. I have also downloaded the (32-bit) windows version of pypy and that works fine from the command line.

How can I get CPython Jupyter to use pypy as a kernel when running my python code?

Simd
  • 19,447
  • 42
  • 136
  • 271
  • are you looking for something like this https://www.reddit.com/r/Python/comments/56nnqe/pypy_with_cpython_35_running_jupyter_notebook_not/ – Matti Lyra May 31 '17 at 18:49
  • @MattiLyra Sort of except I want it to be just the kernel which should be easier than what that person achieved. – Simd May 31 '17 at 18:51
  • looking through this list (https://github.com/jupyter/jupyter/wiki/Jupyter-kernels) it doesn't seem like anyone implemented that already, so you might have to put together your own `pypy` kernel in that case. http://jupyter-client.readthedocs.io/en/latest/kernels.html – Matti Lyra May 31 '17 at 18:54
  • @MattiLyra That's interesting. – Simd May 31 '17 at 18:55
  • turned it into an answer :) – Matti Lyra May 31 '17 at 19:04

2 Answers2

4

Pypy doesn't need a different kernel, it can just use ipykernel. It thus isn't listed separately in the list of Jupyter kernels.

You can use the same methods used for installing kernels for different Python environments to install a kernel for pypy. Eg,

pypy -m pip install ipykernel
pypy -m ipykernel install --user --name pypy --display-name "PyPy"

Or

pypy3 -m pip install ipykernel
pypy3 -m ipykernel install --user --name pypy3 --display-name "PyPy3"

The extra options are just there so that there are useful names for the kernels.

Note, however, that iPython 6 does not support Python 2.7, so if you aren't using PyPy3, you'd need to install iPython 5 in PyPy (I think it should still work with the most recent Jupyter, however).

cge
  • 9,552
  • 3
  • 32
  • 51
0

looking through this list (github.com/jupyter/jupyter/wiki/Jupyter-kernels) it doesn't seem like anyone implemented that already, so you might have to put together your own pypy kernel in that case. jupyter-client.readthedocs.io/en/latest/kernels.html

Matti Lyra
  • 12,828
  • 8
  • 49
  • 67
  • 1
    PyPy doesn't need a different kernel; it can just use ipykernel, the same kernel used for CPython. – cge Aug 16 '17 at 01:03