hydrogen can't connect to R kernel

Created on 27 Jul 2016  Â·  13Comments  Â·  Source: nteract/hydrogen

Hi all,

I can't run R scripts with hydrongen. It seems like if hydrongen can't connect to R kernel. Its runs before make a brew upgrade, however, the R kernel works fine in jupyter notebook .

Here a screen capture of this:

Screen Capture

I try to reinstall hydrogen, reinstall IRkernel, upgrade zmq.

So I don't know where is the problem...

Most helpful comment

Do you have multiple r versions installed on purpose? If not you could remove the outdated ones with brew cleanup.

The kernelspec is pointing to the old r version. The installation instructions for IRkernel say you have to run:

install.packages(c('repr', 'pbdZMQ', 'devtools')) # repr is already on CRAN
devtools::install_github(c('IRkernel/IRdisplay', 'IRkernel/IRkernel'))
IRkernel::installspec()

Running the last line should update the kernelspecs to match the new r version which hopefully should solve your problem.

All 13 comments

Could you take a screenshot of the dev console?

I think the dev console is open in OS X by pressing cmd-opt-i.

Thanks for you help @n-riesco :-).
Yes, here is:

The last two lines report an error launching the R kernel. Could you check whether you're able to run R in the terminal?

Also, could you expand the object in the Kernel spec: line and take a screenshot? I'd like to make sure your kernel spec for R isn't broken.

Of course; yes, I can run R in the terminal:

terminal-R-version

Maybe can be useful this, r versions installed:

r-versions

Kernel spect expanded:

kernel_spec

What happens when you run R -e IRkernel::main()?

I think what you need is the last input on the picture, but I take picture of all attempts to be sure.

terminal

Let's try quoting the argument; could you run R -e 'IRkernel::main()'?

yes, it is the last command with red arrow in the picture.

I think that's the problem. The kernel spec seems broken. You can set up an alternative kernel in the Hydrogen settings. Something like this should work:

{
  "kernelspecs": {
    "r": {
      "spec": {
        "display_name": "custom R",
        "language": "R",
        "argv": ["R", "--slave", "-e", "\"IRkernel::main()\"", "--args", "{connection_file}"],
        "env": {}
      }
    }
  }
}

Do you have multiple r versions installed on purpose? If not you could remove the outdated ones with brew cleanup.

The kernelspec is pointing to the old r version. The installation instructions for IRkernel say you have to run:

install.packages(c('repr', 'pbdZMQ', 'devtools')) # repr is already on CRAN
devtools::install_github(c('IRkernel/IRdisplay', 'IRkernel/IRkernel'))
IRkernel::installspec()

Running the last line should update the kernelspecs to match the new r version which hopefully should solve your problem.

With the solution @n-riesco I've gotten it to work.


I tried what you say @lgeiger, but for some reason I do not get install devtools not understand why. How you say, and in a screenshot above, I have 4 versions of R different. After making brew cleanup gives me an error when trying to install devtools, the dependence git2r not available.

Here the error message:

** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
   ‘pbdZMQ-guide.Rnw’
** testing if installed package can be loaded
* DONE (pbdZMQ)
ERROR: dependency ‘git2r’ is not available for package ‘devtools’
* removing ‘/usr/local/lib/R/3.3/site-library/devtools’

The downloaded source packages are in
    ‘/private/var/folders/cx/7r49499n39z2fw1fq707kym80000gn/T/RtmpOGmfms/downloaded_packages’
Warning messages:
1: In install.packages(c("repr", "pbdZMQ", "devtools")) :
  installation of package ‘git2r’ had non-zero exit status
2: In install.packages(c("repr", "pbdZMQ", "devtools")) :
  installation of package ‘devtools’ had non-zero exit status

But now I see it, is correct the path to R?

mmngreco:TFG mmngreco$ which r
/usr/local/bin/r
mmngreco:TFG mmngreco$ brew list r
/usr/local/Cellar/r/3.3.1_2/bin/R
/usr/local/Cellar/r/3.3.1_2/bin/Rscript
/usr/local/Cellar/r/3.3.1_2/include/ (9 files)
/usr/local/Cellar/r/3.3.1_2/lib/pkgconfig/libR.pc
/usr/local/Cellar/r/3.3.1_2/lib/ (2 files)
/usr/local/Cellar/r/3.3.1_2/R.framework/Versions/ (2183 files)
/usr/local/Cellar/r/3.3.1_2/R.framework/R
/usr/local/Cellar/r/3.3.1_2/share/man/ (2 files)

However, Hydrogen works again.
Thank you very much for the willingness and support.

Hi all,
I get install devtools again with this code:

install.packages('git2r', type='mac.binary.mavericks')

Today, the the kernel spec get the same issue than yesterday when I try to run R with hydrogen.

So, I removed the kernel spec code passed in settings of Hydrogen and I make Hydrogen:Update Kernels, and get and error but next step, I was select kernel with Hydrogen:Select Kernel, and now runs again.

Thanks for the support. :-)
That's all for me.
Bests,

Ups I totally missed your last comment.

I'm glad you got it working. 🎉

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jasonleonhard picture jasonleonhard  Â·  3Comments

gepcel picture gepcel  Â·  3Comments

danbri picture danbri  Â·  4Comments

xmen1412 picture xmen1412  Â·  3Comments

neurotronix picture neurotronix  Â·  4Comments