pythonmacoskernelatom-editorhydrogen

atom: hydrogen installed, but the code is not running (on macOS)


I have the following setting:

running code works in Terminal as well as in atom with script but nothing happen when running the code with hydrogen:

hydrogen output

In the Language Mappings of Hydrogen it is written:

{ "python": "magicpython", "python3": "magicpython" }

when running jupyter kernelspec list I get: python3 /usr/local/etc/jupyter/kernels/python3. In this directory there is a kernel.json file with the following content:

{
 "argv": [
  "/usr/local/Cellar/python/3.7.2_2/bin",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
"env": {
  "PYTHONPATH": "/usr/local/Cellar/ipython/7.3.0/libexec/lib/python3.7/site-packages:/usr/local/Cellar/ipython/7.3.0/libexec/vendor/lib/python3.7/site-packages"
}
,
 "display_name": "Python 3",
 "language": "python"
}

in the directory /usr/local/Cellar/python/3.7.2_2/bin there are the following items

2to3            pip3.7          python3.7-config
2to3-3.7        pydoc3          python3.7m
easy_install-3.7    pydoc3.7        python3.7m-config
idle3           python3         pyvenv
idle3.7         python3-config      pyvenv-3.7
pip3            python3.7       wheel3

Is the path in the kernel.json file the correct one?

I also looked at this github page but I couldn't solve the problem

What am I doing wrong?


Solution

  • Your kernelspec argv argument is pointing to ../python.3x/bin instead of directly to the python3 executable. Pointing to the executable directly with ../python.3x/bin/python3 is more typical and might be the issue.

    How did you install your kernel? I'd recommend taking a look at this kernel installation guide and probably reinstalling your kernel with, in your case, python3 -m ipykernel install. I think this will work, but, manually editing the kernel.json file would be another (not recommended) way to fix this.