Description:
Running Hydrogen for Ruby doesn't work
Steps to Reproduce:
2+2Cmd-EnterVersions:
OS: Mac High Sierra v10.13.6
Hydrogen: 2.5.1
Atom: 1.28.2
You can get this information from copy and pasting the output of atom --version from the command line.
Logs:
I get the following error message:
No kernel for grammar Ruby found
Check that the language for this file is set in Atom and that you have a Jupyter kernel installed for it.
I definitely have the file set for Ruby (it states it at the bottom of the screen).
I also have a Jupyter Kernel installed for it. I can run a Jupyter notebook with Ruby and when I run jupyter kernelspec list --json I have a Ruby kernel:
{
"kernelspecs": {
"python3": {
"resource_dir": "/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/python3",
"spec": {
"argv": [
"/Users/jonnybrooks-bartlett/anaconda3/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"env": {},
"display_name": "Python 3",
"language": "python",
"interrupt_mode": "signal",
"metadata": {}
}
},
"julia-0.6": {
"resource_dir": "/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.6",
"spec": {
"argv": [
"/Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia",
"-i",
"--startup-file=yes",
"--color=yes",
"/Users/jonnybrooks-bartlett/.julia/v0.6/IJulia/src/kernel.jl",
"{connection_file}"
],
"env": {},
"display_name": "Julia 0.6.2",
"language": "julia",
"interrupt_mode": "signal",
"metadata": {}
}
},
"python-3": {
"resource_dir": "/usr/local/share/jupyter/kernels/python-3",
"spec": {
"argv": [
"/Users/jonnybrooks-bartlett/anaconda3/envs/rlm/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"env": {},
"display_name": "Python-3",
"language": "python",
"interrupt_mode": "signal",
"metadata": {}
}
},
"ruby": {
"resource_dir": "/Users/jonnybrooks-bartlett/.ipython/kernels/ruby",
"spec": {
"argv": [
"/Users/jonnybrooks-bartlett/.rvm/gems/ruby-2.4.1/bin/iruby",
"kernel",
"{connection_file}"
],
"env": {},
"display_name": "Ruby 2.4.1",
"language": "ruby",
"interrupt_mode": "signal",
"metadata": {}
}
}
}
}
In fact, Ruby is the only one it can't from that list.

Any ideas?
What happens when you run the command hydrogen:update-kernels? does it show the kernel for Ruby?
It only shows up for the 3 kernels:
Hydrogen uses the package kernelspecs to update the list of kernels. In the past, I've seen that this package drops silently invalid kernelspecs. I don't see anything wrong with the kernelspec for Ruby.
Are you familiar with Node.js and npm? If so, I'd try to reproduce the problem in Node and open an issue at https://github.com/nteract/kernelspecs :
> var ks = require("./kernelspecs");
undefined
> ks.findAll().then(console.log)
Promise { <pending> }
> { coffescript:
{ name: 'coffescript',
files:
[ '/home/user/.local/share/jupyter/kernels/coffescript/kernel.json',
'/home/user/.local/share/jupyter/kernels/coffescript/logo-32x32.png',
'/home/user/.local/share/jupyter/kernels/coffescript/logo-64x64.png' ],
resources_dir: '/home/user/.local/share/jupyter/kernels/coffescript',
spec:
{ argv: [Object],
display_name: 'CoffeScript (Node.js)',
language: 'coffeescript' } },
javascript:
{ name: 'javascript',
files:
[ '/home/user/.local/share/jupyter/kernels/javascript/kernel.json',
'/home/user/.local/share/jupyter/kernels/javascript/logo-32x32.png',
'/home/user/.local/share/jupyter/kernels/javascript/logo-64x64.png' ],
resources_dir: '/home/user/.local/share/jupyter/kernels/javascript',
spec:
{ argv: [Object],
display_name: 'Javascript (Node.js)',
language: 'javascript' } },
python3:
{ name: 'python3',
files:
[ '/usr/share/jupyter/kernels/python3/kernel.json',
'/usr/share/jupyter/kernels/python3/logo-32x32.png',
'/usr/share/jupyter/kernels/python3/logo-64x64.png' ],
resources_dir: '/usr/share/jupyter/kernels/python3',
spec: { argv: [Object], display_name: 'Python 3', language: 'python' } } }
I confess that I'm not really familiar with Node.js and npm but I'll see what I can do about reproducing the error
I've run that command and lo and behold, kernel specs doesn't return the Ruby kernel. I assume this is no longer an issue with this package so I'll close the issue here and open one on the kernelspecs repo. Thanks @n-riesco
https://github.com/nteract/jupyter-paths/issues/27
@JonnyCBB Thank you for chasing this.
I do have another problem. Maybe you could advise if it makes sense to reopen the issue or create a new one.
I've managed to fix the original problem by moving the Ruby kernel files into a directory that is picked up by the jupyter-paths package. Now I can run the command to hydrogen:update-kernels and the ruby kernel shows up.
The problem now is that Hyrdogen doesn't seem to do anything when I try to evaluate a statement. Nothing appears in the debugging console at the point when I try to evaluate the statement. I'm not sure what the problem could be at the moment.
With that said, here are the outputs of the console. I have some new [Violoation] messages which may be to do with it but in all honesty they don't mean much to me.

FYI Hydrogen seems to work normally for my Python kernel. It evaluates and prints the result next to the statement on the screen.
@JonnyCBB See here the instructions to enable debug messages on the dev console.
This is what I get when I evaluate a Ruby statement that doesn't work:

This is what I get evaluating a Python one that does work:

@JonnyCBB Thank you for the logs. Now I can see that the issue is happening because Hydrogen expects iRuby to be setup a control socket.
If you feel like tinkering, you can try this:
lib/zmq-kernel.js in an editor"controlSocket" from this line https://github.com/nteract/hydrogen/blob/c9826b18bc715b2a60692b26d5c6c5336430288c/lib/zmq-kernel.js#L117Thank you so much @n-riesco. That worked. My other kernels seem unaffected too 馃憤
I have a few more questions purely because I'm interested:
I'm not sure if you're a maintainer but you seem very knowledgeable.
Once again, thanks so much for sorting this out so quickly for me
What side effects could I expect by making the changes that you suggested?
I don't expect any, because Hydrogen doesn't use the control socket at the moment.
Do you think that these changes will be included in the next release of Hydrogen or will I have to make these changes after every update?
If you're up for it, please, open a PR and I'll review it. The PR should remove all instances of crontrolSocket from lib/zmq-kernel.js: