1

I have python3 kernel and want to add python2 kernel to my Jupyter notebook.

Command I used to add python2:

jupyter kernelspec install C:\Python27\

I get:

[InstallKernelSpec] Installed kernelspec python27 in C:\ProgramData\jupyter\kernels\python27

But when I list kernels:

Available kernels:
  python3    c:\users\usrer1\appdata\local\programs\python\python36-32\share\jupyter\kernels\python3

Why isn't the python2 kernel adding to the list?

Ani Menon
  • 27,209
  • 16
  • 105
  • 126
  • Why not move / copy from `C:\ProgramData\jupyter\kernels\python27` to the other folder? – OneCricketeer Sep 25 '17 at 05:45
  • Oh, hadn't noticed that. – Ani Menon Sep 25 '17 at 09:44
  • @cricket_007 I moved the `python27` directory into the other path but am still unable to find the other kernel in the Change Kernel option. Also its not showing up when I list the kernels. – Ani Menon Sep 25 '17 at 09:47
  • Hmm. Should be relocatable. I've done it on my Mac... Have you compared the folder contents for python3 and 2 kernels? There should be a `kernel.json` and a few other things – OneCricketeer Sep 25 '17 at 12:31
  • @cricket_007 I see a `kernel.json` in python3 but don't see it in python27 which I just copied. – Ani Menon Sep 27 '17 at 09:45
  • That might explain why you aren't seeing Python2 in Jupyter, then – OneCricketeer Sep 27 '17 at 16:19
  • Any idea why this is happening? – Ani Menon Sep 28 '17 at 07:40
  • I've not use Jupyter on windows, but I can say that that putting a Python2 folder within `python36-32` definitely isn't correct. I think there's an option on the kernelspec install that might be `--user`. Otherwise, the documentation in the answer below is not wrong. – OneCricketeer Sep 28 '17 at 12:23

1 Answers1

0

You will find this message at the link below.

"This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7. If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release)."

https://ipython.readthedocs.io/en/latest/install/kernel_install.html

Here is a link to the 5.x docs...

http://ipython.readthedocs.io/en/5.x/install/kernel_install.html#kernel-install

Here is another resource that might help you. It also mentions that yes, the fragmentation with the docs is a bit of hassle.

https://github.com/jupyter/jupyter/issues/71

Many of the suggestions you'll find at the links here assume you are either using some version of pip or Anaconda. I too ran into a bit of trouble getting multiple kernels to work, however, Anaconda really makes things much simpler and easier to manage. They even offer a Python 2.7 version of this download.

Hope it works out; Jupyter Notebooks are a joy to use.

eric
  • 1,029
  • 1
  • 8
  • 9
  • 1
    You can still install the Python2 kernel. IPython itself doesn't support Python2... Besides, page still lists "Kernels for Python 2 and 3" – OneCricketeer Sep 25 '17 at 05:43
  • @cricket_007 yeah that's interesting. You're advice seems like a much quicker fix, I hope it works out for OP. – eric Sep 25 '17 at 06:06