nteract / hydrogen

:atom: Run code interactively, inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor.
https://nteract.gitbooks.io/hydrogen/
MIT License
3.92k stars 334 forks source link

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

Closed Rutrus closed 6 years ago

Rutrus commented 6 years ago

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

Rutrus commented 6 years ago

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

mlgarchery commented 6 years ago

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

BenRussert commented 6 years ago

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

nijanthanvijayakumar commented 5 years ago

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 !