nteract / kernelspecs

:card_index: Find Jupyter kernelspecs on a system
BSD 3-Clause "New" or "Revised" License
9 stars 11 forks source link

kernelspecs doesn't find Ruby kernel #32

Closed JonnyCBB closed 6 years ago

JonnyCBB commented 6 years ago

I've run: require('kernelspecs').findAll().then(console.log) which doesn't return the Ruby kernel on my machine. This is the response I get:

Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] } }
> { 'julia-0.6':
   { name: 'julia-0.6',
     files:
      [ '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.6/kernel.json',
        '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.6/logo-32x32.png',
        '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.6/logo-64x64.png' ],
     resources_dir: '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.6',
     spec: { display_name: 'Julia 0.6.2', argv: [Array], language: 'julia' } },
  'julia-0.7':
   { name: 'julia-0.7',
     files:
      [ '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.7/kernel.json',
        '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.7/logo-32x32.png',
        '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.7/logo-64x64.png' ],
     resources_dir: '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.7',
     spec:
      { display_name: 'Julia 0.7.0-beta2',
        argv: [Array],
        language: 'julia' } },
  python3:
   { name: 'python3',
     files:
      [ '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/python3/kernel.json',
        '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/python3/logo-32x32.png',
        '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/python3/logo-64x64.png' ],
     resources_dir: '/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/python3',
     spec: { argv: [Array], display_name: 'Python 3', language: 'python' } },
  'python-3':
   { name: 'python-3',
     files:
      [ '/usr/local/share/jupyter/kernels/python-3/kernel.json',
        '/usr/local/share/jupyter/kernels/python-3/logo-32x32.png',
        '/usr/local/share/jupyter/kernels/python-3/logo-64x64.png' ],
     resources_dir: '/usr/local/share/jupyter/kernels/python-3',
     spec: { argv: [Array], display_name: 'Python-3', language: 'python' } } }

However, running jupyter kernelspec list --json does return the Ruby kernel. Here's the response:

{
  "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": {}
      }
    },
    "julia-0.7": {
      "resource_dir": "/Users/jonnybrooks-bartlett/Library/Jupyter/kernels/julia-0.7",
      "spec": {
        "argv": [
          "/Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia",
          "-i",
          "--startup-file=yes",
          "--color=yes",
          "/Users/jonnybrooks-bartlett/.julia/packages/IJulia/RBfP/src/kernel.jl",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Julia 0.7.0-beta2",
        "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": {}
      }
    }
  }
}

and I can create and Jupyter notebook where I can happily evaluate Ruby commmands.

I followed the Mac instructions on the IRuby repo to get the kernel but I don't know why I can't get it using kernelspecs.

JonnyCBB commented 6 years ago

Turns out that kernelspecs uses the jupyter-paths package to locate the kernel directories and its the jupyter-paths dataDirs method that misses the directory containing the ruby kernel so I'm going to close this issue here and open another one in the jupyter-paths repo.