Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No kernel for grammar Python found Check that the language for this file is set in Atom and that you have a Jupyter kernel installed for it. #1074

Closed
worker000000 opened this issue Nov 1, 2017 · 26 comments
Labels

Comments

@worker000000
Copy link

2q6 q091 nd_c _hb 3

dear professor
as you can see, when i try to run 'print 123', it showed me this, and before this, i run 'pip install ipykernel ' in the windows cmd, it told me that 'Successfully installed backports-abc-0.5 backports.shutil-get-terminal-size-1.0.0 certifi-2017.7.27.1 colorama-0.3.9 decorator-4.1.2 enum34-1.1.6 ipykernel-4.6.1 ipython-5.5.0 ipython-genutils-0.2.0 jupyter-client-5.1.0 jupyter-core-4.4.0 pathlib2-2.3.0 pickleshare-0.7.4 prompt-toolkit-1.0.15 pygments-2.2.0 python-dateutil-2.6.1 pyzmq-16.0.3 scandir-1.6 simplegeneric-0.8.1 singledispatch-3.4.0.3 tornado-4.5.2 traitlets-4.3.2 wcwidth-0.1.7 win-unicode-console-0.5'.
so what I should I do to solve this problem(win10 platform), thanks a lot for all.

@lgeiger
Copy link
Member

lgeiger commented Nov 1, 2017

This looks like a outdated version of Hydrogen and Atom. Which version are you running?
Please update if it's not the latest

@LannyFox
Copy link

LannyFox commented Nov 7, 2017

Hi,

I'm having the same issues on my windows machine. My Atom and and Hydrogen are both the most recent releases.

Atom - 1.21.2
Hydrogen - 2.0.1

I updated both yesterday and have been getting this error since then. I re-installed Hydrogen and Ipykernel and still have the same issue. I see from past threads that there used to be a kernelspec setting where you could direct hydrogen to the kernel but that seems to have been removed. Any ideas how to resolve this issue?

Thanks!

@rafaveguim
Copy link

Same here.

@yangyang2000
Copy link

Same issues on Windows machine

@LannyFox
Copy link

[Problem Solved]

For me the issue was solved when I added anaconda3 and anaconda3/Scripts to the PATH variable.

Hope this helps others as well!

@lgeiger
Copy link
Member

lgeiger commented Nov 21, 2017

Running

python -m pip install ipykernel
python -m ipykernel install --user

should fix the problem.

Please try the latest version of hydrogen.

@denismeia
Copy link

@lgeiger Thanks! I've tried everything and it looks like YOUR solution worked for me! I appreciate that.

@casperdcl
Copy link
Member

restarting atom worked for me

@eduhh94
Copy link

eduhh94 commented Apr 7, 2019

Running

python -m pip install ipykernel
python -m ipykernel install --user

should fix the problem.

Please try the latest version of hydrogen.

This doesnt work on Mac. When I execute the second command I get:


python -m ipykernel install --user
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Library/Python/2.7/site-packages/ipykernel/__main__.py", line 2, in <module>
    from ipykernel import kernelapp as app
  File "/Library/Python/2.7/site-packages/ipykernel/kernelapp.py", line 38, in <module>
    from .iostream import IOPubThread
  File "/Library/Python/2.7/site-packages/ipykernel/iostream.py", line 25, in <module>
    from jupyter_client.session import extract_header
  File "/Library/Python/2.7/site-packages/jupyter_client/session.py", line 51, in <module>
    from dateutil.tz import tzutc
  File "/Library/Python/2.7/site-packages/dateutil/tz/__init__.py", line 2, in <module>
    from .tz import *
  File "/Library/Python/2.7/site-packages/dateutil/tz/tz.py", line 21, in <module>
    from six.moves import _thread
ImportError: cannot import name _thread

@sagitaninta
Copy link

Running

python -m pip install ipykernel
python -m ipykernel install --user

should fix the problem.

Please try the latest version of hydrogen.

This actually works in Windows 10 if by working means everything necessary was installed. As I have python3, I was running

python3 -m pip install ipykernel
python3 -m ipykernel install --user

Buuut when I run atom again and try to run a script, it gave meee
image

I got the latest Atom version and Hydrogen version (everything was installed yesterday).
Any help appreciated.

@terasakisatoshi
Copy link

same problem occurs for Mac OSX Mojave as above.

#1074 (comment)

@aviatesk
Copy link
Member

Can you check the kernel you want to run is listed in: jupyter kernelspec list ?

This gonna be like:

Available kernels:
  java-11       C:\Users\aviat\AppData\Roaming\jupyter\kernels\java-11
  javascript    C:\Users\aviat\AppData\Roaming\jupyter\kernels\javascript
  julia-1.1     C:\Users\aviat\AppData\Roaming\jupyter\kernels\julia-1.1
  julia-1.2rc     C:\Users\aviat\AppData\Roaming\jupyter\kernels\julia-1.2rc
  py36          C:\Users\aviat\AppData\Roaming\jupyter\kernels\py36
  r-3.5         C:\Users\aviat\AppData\Roaming\jupyter\kernels\r-3.5
  python3       C:\Users\aviat\Anaconda3\share\jupyter\kernels\python3

And if each JSON file contains language scheme, Hydrogen should detect the kernel.

Example: C:\Users\aviat\AppData\Roaming\jupyter\kernels\py36\kernel.json

{
 "argv": [
  "C:\\Users\\aviat\\Anaconda3\\envs\\py36\\python.exe",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3.6",
 "language": "python"
}

@aviatesk aviatesk reopened this Jul 13, 2019
@terasakisatoshi
Copy link

@aviatesk

Hi, thank you for your reply, here is my result.

bash-3.2$ jupyter kernelspec list
Available kernels:
  julia-1.1    /Users/terasakisatoshi/Library/Jupyter/kernels/julia-1.1
  python3      /Users/terasakisatoshi/.pyenv/versions/3.6.8/share/jupyter/kernels/python3
bash-3.2$ pyenv which python
/Users/terasakisatoshi/.pyenv/versions/3.6.8/bin/python
bash-3.2$ which jupyter
/Users/terasakisatoshi/.pyenv/shims/jupyter
bash-3.2$ cat ~/.pyenv/versions/3.6.8/share/jupyter/kernels/python3/kernel.json 
{
 "argv": [
  "python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"

@aviatesk
Copy link
Member

aviatesk commented Jul 13, 2019

Sorry jupyter kernelspec list might not be enough to track the issue.

Essentially, we search local kernels by spawning: jupyter -paths
and see the data section of the stdout.

If the command doesn't show directories containing your Python kernels, activating the pyenv first or setting environment variable described here before starting up Atom might help you.

@aviatesk
Copy link
Member

aviatesk commented Jul 13, 2019

@BenRussert @lgeiger
Do you usually use pyenv ? If so, can you tell us your configurations ?

@terasakisatoshi
Copy link

Here is my result of jupyter --paths

$ jupyter --paths
config:
    /Users/terasakisatoshi/.jupyter
    /Users/terasakisatoshi/.pyenv/versions/3.6.8/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /Users/terasakisatoshi/Library/Jupyter
    /Users/terasakisatoshi/.pyenv/versions/3.6.8/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /Users/terasakisatoshi/Library/Jupyter/runtime

I think Hydrogen is trying to read /Users/terasakisatoshi/Library/Jupyter not /Users/terasakisatoshi/.pyenv/versions/3.6.8/share/jupyter.

@aviatesk
Copy link
Member

Umm Hydrogen is set up to read every kernels/*/kernel.json file under data dirs above...

This problem seems to be rooted in this npm package that are also used for nteract.
I will ask for this on our slack and please wait patiently.

@zhenkunl
Copy link

If you install python under an anaconda virtual environment and meet the same error on Mac OS, first make sure you have installed python kernel using jupyter --paths

(python3) [zhenkunli:/Users/zhenkunli]$ jupyter --paths
config:
    /Users/zhenkunli/.jupyter
    /anaconda3/envs/python3/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /Users/zhenkunli/Library/Jupyter
    /anaconda3/envs/python3/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /Users/zhenkunli/Library/Jupyter/runtime

then all you need to do is create a directory kernels under /Users/zhenkunli/Library/Jupyter and copy the directory /anaconda3/envs/python3/share/jupyter/python3 to /Users/zhenkunli/Library/Jupyter/kernels, you will find it works. Note python3 is the environment name of mine. Hope this helps.

@zhenkunl
Copy link

Another way to make Hydrogen work is to launch Atom in a terminal which has load your anaconda environment if you have set atom in your system PATH, i.e., (python3) [zhenkunli:/Users/zhenkunli]$ atom

@terasakisatoshi
Copy link

@zhenkunl
Thank you,

I'm using Python 3.6.8 which is managed by pyenv.
I found kernels at on my PC

  • ~/.pyenv/versions/3.6.8/share/jupyter/kernels/python3

which may correspond to your /anaconda3/envs/python3/share/jupyter/python3.
I copied my directory ~/.pyenv/versions/3.6.8/share/jupyter/kernels/python3 to
~/Library/Jupyter/kernels .

Here is my result:
image

hooray

@zhenkunl
Copy link

@terasakisatoshi I am very happy to hear it works. That's cool.

@terasakisatoshi
Copy link

@zhenkunl Yeah. Thank you so much!

@aviatesk
Copy link
Member

@zhenkunl
Thanks for your contribution !
I've just added the section about this workaround in our troubleshooting guide and closing this issue.

@IshaVDave
Copy link

restarting atom worked for me

That helped... thanks!!

@Olumat
Copy link

Olumat commented Jul 20, 2020

Hello,

I am currently struggeling with the same issue and although I have the kernels/python3 folder in my jupyter data path as suggested by @zhenkunl, which is: C:\Users\user\AppData\Roaming\jupyter on windows. Any suggestions what else might be missing?

@ScottGuthart
Copy link

@zhenkunl
Thank you,

I'm using Python 3.6.8 which is managed by pyenv.
I found kernels at on my PC

  • ~/.pyenv/versions/3.6.8/share/jupyter/kernels/python3

which may correspond to your /anaconda3/envs/python3/share/jupyter/python3.
I copied my directory ~/.pyenv/versions/3.6.8/share/jupyter/kernels/python3 to
~/Library/Jupyter/kernels .

Here is my result:
image

hooray

This was my issue too! I created a symbolic link instead of copying.
ln -s ~/.pyenv/versions/3.9.1/share/jupyter/kernels/python3 ~/Library/Jupyter/kernels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests