Hydrogen: Hydrogen can't find ipykernel_launcher because Python 3 kernel uses python 2.7

Created on 26 Dec 2017  路  4Comments  路  Source: nteract/hydrogen

Python 3 kernel uses python 2.7

Description:
Same problem here: https://github.com/nteract/hydrogen/issues/730
Solved here: https://github.com/phenology/infrastructure/issues/23

When running simple python script with Hydrogen, receive error in: /usr/bin/python: No module named ipykernel_launcher

Using Python 3 installed from repositories. Jupyter notebooks run fine from the terminal and ipython works within that environment, but within Atom, Hydrogen cannot seem to start the kernel. When selecting Kernel within Hydrogen, "Python 3" shows up as automatically found kernel to select.

Steps to Reproduce:

Run python script

Versions:

Ubuntu : 16.04.3
Atom : 1.23.1
Electron: 1.6.15
Chrome : 56.0.2924.87
Node : 7.4.0
Hydrogen 2.2.0

Logs:

/usr/bin/python: No module named ipykernel_launcher

Most helpful comment

Solution:

  1. Edit /usr/local/share/jupyter/kernels/python3/kernel.json
  2. In line 3: Replace python with python3
  3. Restart ATOM (not only the plugin)

Result:

{
 "argv": [
  "python3",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

Explanation:
python command always points to python2

All 4 comments

Solution:

  1. Edit /usr/local/share/jupyter/kernels/python3/kernel.json
  2. In line 3: Replace python with python3
  3. Restart ATOM (not only the plugin)

Result:

{
 "argv": [
  "python3",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

Explanation:
python command always points to python2

If it could help anyone:
I was in an anaconda environment, the kernel.json file was in "anaconda3/envs//share/jupyter/kernels/python3".
Don't forget to launch atom after you activated the env:
$ source activate name_of_the_env
$ atom

I will close this, thanks for posting your solution. Feel free to send a pr if we need anything added to the docs!

Solution:

1. Edit `/usr/local/share/jupyter/kernels/python3/kernel.json`

2. In line 3: Replace `python` with `python3`

3. Restart ATOM (not only the plugin)

Result:

{
 "argv": [
  "python3",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

Explanation:
python command always points to python2

Worked like charm for me. Thank you, @Rutrus !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nils-werner picture nils-werner  路  3Comments

Mike-MU10 picture Mike-MU10  路  4Comments

gepcel picture gepcel  路  3Comments

wadethestealth picture wadethestealth  路  3Comments

ekoepplin picture ekoepplin  路  4Comments