When I try to run hydrogen on atom I obtain this error:
Python 3
/usr/bin/python: No module named ipykernel_launcher
The reason seems very simple to me, /usr/bin/python in my system is python2, but I have to use python3 which in my system is /usr/bin/python3.
if I try to import ipykernel from python2 obviously return me an error because I have installed this module only for python3, which is the version of python that I want to use.
The solutions in my opinion are 2, pointing /usr/bin/python to python3 (and directly I can not do it because I would break the system, I could use virtualenv but I do not want to do it), or make atom/hydrogen allow me to change version of python.
Sorry I searched far and wide, I found many people with similar problems but I could not find a solution for mine.
In the end I thought about writing to you although probably this setting comes from atom.
But even if so, wouldn't it be a good idea to allow you to set the python path in the hydrogen settings and avoid similar problems?
Here it seems that someone had done it, but that command doesn't exist in my palette at all:
https://github.com/nteract/hydrogen/pull/138
Atom : 1.41.0
Hydrogen :2.13.1
All installed today
That issue is from 2015 in which hydrogen and jupyter have changed a lot. Hydrogen has become a language agnostic frontend to jupyter kernels, and it has great success. However instead of using paths of our own, which would become a large maintenance cost, we simply just use jupyter paths. If your kernel is not properly installed to be used by jupyter, you won't be able to use it for hydrogen either. Unfortunately I can't really give you guidance except for to read the nteract docs for installing kernels. There are definitely ways to avoid setting your python path.
While you can find the resources under the installation tab in our docs, which I recommend you read, here is how to install kernels https://nteract.io/kernels. If you have any further questions please feel free to ask them here.
I referred precisely on that page and I used the global installation, this is the command in the history of my bash:
pip3 install ipykernel --upgrade
"pip3" is the executable of ubuntu completely identical to
"python3 -m pip" (interchangeable), I always use the option "--upgrade", for new installations nothing changes, and the command is always the same also for update.
to be sure I launched it again and it was run without any problem (obviously it has not updated anything since I installed it a few days ago):
vinnie:vinnie$ pip3 install ipykernel --upgrade
Collecting ipykernel
Using cached https://files.pythonhosted.org/packages/e1/92/8fec943b5b81078399f969f00557804d884c96fcd0bc296e81a2ed4fd270/ipykernel-5.1.3-py3-none-any.whl
Collecting ipython>=5.0.0 (from ipykernel)
Using cached https://files.pythonhosted.org/packages/81/2e/59cdacea6476a4c21b7c090a91250ffbcd085900f5eb9f4e4d68dd2ee4e3/ipython-7.9.0-py3-none-any.whl
Collecting tornado>=4.2 (from ipykernel)
Collecting traitlets>=4.1.0 (from ipykernel)
Using cached https://files.pythonhosted.org/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl
Collecting jupyter-client (from ipykernel)
Using cached https://files.pythonhosted.org/packages/13/81/fe0eee1bcf949851a120254b1f530ae1e01bdde2d3ab9710c6ff81525061/jupyter_client-5.3.4-py2.py3-none-any.whl
Collecting pexpect; sys_platform != "win32" (from ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/0e/3e/377007e3f36ec42f1b84ec322ee12141a9e10d808312e5738f52f80a232c/pexpect-4.7.0-py2.py3-none-any.whl
Collecting pickleshare (from ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl
Collecting setuptools>=18.5 (from ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/d9/de/554b6310ac87c5b921bc45634b07b11394fe63bc4cb5176f5240addf18ab/setuptools-41.6.0-py2.py3-none-any.whl
Collecting jedi>=0.10 (from ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/55/54/da994f359e4e7da4776a200e76dbc85ba5fc319eefc22e33d55296d95a1d/jedi-0.15.1-py2.py3-none-any.whl
Collecting prompt-toolkit<2.1.0,>=2.0.0 (from ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/87/61/2dfea88583d5454e3a64f9308a686071d58d59a55db638268a6413e1eb6d/prompt_toolkit-2.0.10-py3-none-any.whl
Collecting pygments (from ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/5c/73/1dfa428150e3ccb0fa3e68db406e5be48698f2a979ccbcec795f28f44048/Pygments-2.4.2-py2.py3-none-any.whl
Collecting backcall (from ipython>=5.0.0->ipykernel)
Collecting decorator (from ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/8f/b7/f329cfdc75f3d28d12c65980e4469e2fa373f1953f5df6e370e84ea2e875/decorator-4.4.1-py2.py3-none-any.whl
Collecting six (from traitlets>=4.1.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl
Collecting ipython-genutils (from traitlets>=4.1.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting jupyter-core>=4.6.0 (from jupyter-client->ipykernel)
Using cached https://files.pythonhosted.org/packages/fb/82/86437f661875e30682e99d04c13ba6c216f86f5f6ca6ef212d3ee8b6ca11/jupyter_core-4.6.1-py2.py3-none-any.whl
Collecting pyzmq>=13 (from jupyter-client->ipykernel)
Using cached https://files.pythonhosted.org/packages/75/89/6f0ea51ffa9c2c00c0ab0460f137b16a5ab5b47e3b060c5b1fc9ca425836/pyzmq-18.1.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting python-dateutil>=2.1 (from jupyter-client->ipykernel)
Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Collecting parso>=0.5.0 (from jedi>=0.10->ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/a3/bd/bf4e5bd01d79906e5b945a7af033154da49fd2b0d5b5c705a21330323305/parso-0.5.1-py2.py3-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.1.0,>=2.0.0->ipython>=5.0.0->ipykernel)
Using cached https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Installing collected packages: ptyprocess, pexpect, pickleshare, six, decorator, ipython-genutils, traitlets, setuptools, parso, jedi, wcwidth, prompt-toolkit, pygments, backcall, ipython, tornado, jupyter-core, pyzmq, python-dateutil, jupyter-client, ipykernel
Successfully installed backcall-0.1.0 decorator-4.4.1 ipykernel-5.1.3 ipython-7.9.0 ipython-genutils-0.2.0 jedi-0.15.1 jupyter-client-5.3.4 jupyter-core-4.6.1 parso-0.5.1 pexpect-4.7.0 pickleshare-0.7.5 prompt-toolkit-2.0.10 ptyprocess-0.6.0 pygments-2.4.2 python-dateutil-2.8.1 pyzmq-18.1.0 setuptools-41.6.0 six-1.13.0 tornado-6.0.3 traitlets-4.3.3 wcwidth-0.1.7
vinnie:vinnie$
As I tried to explain in my report, the problem is that atom or hydrogen tries to run kernels for python 2 (which in my system is /usr/bin/python as reported in its error), when ipythonkernel for me is installed for python3 (in my system /usr/bin/python3 or /usr/bin/python3.6).
So the problem is not that my system can't see the jupyter paths, the problem is that hydrogen or atom tries to use the wrong version of python and I haven't found any way to tell to one or both of them that I want to use python3 as an executable and not python.
So I'm not asking to change the structure of your program, I'm asking how I can indicate to hydrogen the correct version of python.
I would like to say also that I didn't make any python installation changes on my system but it was all installed from the official repository and through pips installed from the repository and I still have problems, but I think that in this way it is impossible for anyone to have python in a different path from the hardcoded choosed-one of atom/hydrogen.
We don't control the executable or run python. We run your kernel. If it doesn't use the correct path thats your kernels responsibility. I think what you mean is how do you get ipykernel to run python 3.
I think that in this way it is impossible for anyone to have python in a different path from the hardcoded choosed-one of atom/hydrogen.
This is untrue. Your kernel controls the executable path, and so therefore if you change your kernel to run correctly, hydrogen can run it from anywhere. You just have an improper ipykernel installation. See more below
you may want to read all of #730 as it discusses the proper fixes. But in order to speed up the process, jupyter kernelspec list --json will output kernel information. The first string element under argv of your python3 kernel should point to your python3 exe, if it does not you can manually change the first element of argv in the kernel.json file located at the python3 kernels resource directory.
Ok, I came back to write you that a test with venv was successful, so this confirms my problem (because in virtual enviorment the executable "python" became connected to python3, but I don't want to use a virtual enviorment because I don't want to reinstall all the libraries I already use), however since you answered me I tried to follow the page of the issue you passed me and trying to execute some commands in this page the problem seems to have fixed.
I think the command that solved the problem was python3 -m ipykernel install --user but I'm not totally sure because I don't really understand how jupyter works and I miss a lot of things.
Now I want to test bit Atom + Hydrogen, I've tried a bit of everything and maybe it's a right time that I change editors.
In the meantime I thank you and apologize if I have been a bit too strong in my messages.
To add to this ticket, in case anyone in the future will find this useful, I found that python3 -m ipykernel install --user also solved a similar issue I was struggling with! :)
For reference, my issue was (I think) that my jupyter was searching for the wrong python. I used jupyter kernelspec list --json before and after the python3 -m ipykernel install --user command and saw a change of
"argv": [
"/Applications/Xcode.app/Contents/Developer/usr/bin/python3",
to
"argv": [
"/usr/local/opt/[email protected]/bin/python3.8",
Most helpful comment
Ok, I came back to write you that a test with venv was successful, so this confirms my problem (because in virtual enviorment the executable "python" became connected to python3, but I don't want to use a virtual enviorment because I don't want to reinstall all the libraries I already use), however since you answered me I tried to follow the page of the issue you passed me and trying to execute some commands in this page the problem seems to have fixed.
I think the command that solved the problem was
python3 -m ipykernel install --userbut I'm not totally sure because I don't really understand how jupyter works and I miss a lot of things.Now I want to test bit Atom + Hydrogen, I've tried a bit of everything and maybe it's a right time that I change editors.
In the meantime I thank you and apologize if I have been a bit too strong in my messages.