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

Installing R kernel for Jupyter notebook #25

Open
yoshimoncho opened this issue Dec 11, 2017 · 15 comments
Open

Installing R kernel for Jupyter notebook #25

yoshimoncho opened this issue Dec 11, 2017 · 15 comments

Comments

@yoshimoncho
Copy link

Is it possible to install R kernel in Termux?
If yes, how can I do it?
Thanks

@namdnguyen
Copy link

Hi @yoshimoncho, It is possible to install IRkernel. I wish I had made notes about the process, so maybe if you could try to install it and let us know what errors you are running into. I'll list some of the steps that I do remember, many of which had errors installing dependencies that had to be resolved. The steps come from the IRkernel installation instructions (https://github.com/IRkernel/IRkernel), but have comments about changes I had to make.

  1. Install devtools in R: install.packages('devtools')
  2. I couldn't get the recommended step of using devtools::install_github to work, so I had to download IRkernel and installed locally. Download the zip of IRkernel from the master branch or the latest release, such as IRkernel-0.8.11.zip.
  3. Run devtools::install_local('IRkernel-master.zip'), if the zip file is in your R working directory. Otherwise, include the path or start R from the same directory as the zip file. If you run into problems with the zip file, you can unzip and run devtools::install_local('IRkernel-master') for the path where you extracted the archive.
  4. Run IRkernel::installspec()

I was able to install the tidyverse packages, which I could load and use from a R Jupyter Notebook. Let me know if you get stuck!

@clancia
Copy link

clancia commented Mar 20, 2018

Hi there, I got stuck at point 3

> devtools::install_local('IRkernel-master')
Installing IRkernel
Installation failed: error in running command

DId you encounter the same error as well?

Thanks in advance!

@namdnguyen
Copy link

Hi @clancia. I may have gotten that as well. If I did, I don't recall how I fixed it. Let me find another device and try to install it again to see if there are any missing steps from the original set of instructions.

@clancia
Copy link

clancia commented Apr 13, 2018 via email

@richgoldberg
Copy link

Before trying to install from GitHub using devtools, try setting R to use its internal unzip function:
options(unzip = "internal")

@richgoldberg
Copy link

Also, if your R kernel dies because of missing X-11, check out this GitHub thread. The last recommendation to add option(bitmapType="cairo") to the kernel.json file fixed it for me.

@clancia
Copy link

clancia commented May 26, 2018 via email

@its-pointless
Copy link
Owner

yes im getting the same thing
will have a look see if i cant get working
amusingly i have got julia working in jupyter-notebook.

@its-pointless
Copy link
Owner

k got it working
may have to install Cairo in R and that needs env variables set
export CAIRO_LIBS="-lcairo"
export CAIRO_CFLAGS="-I$PREFIX/include/cairo"
then install Cairo in R
install.packages('Cairo')
then exit R and do this
cat > $PREFIX/share/jupyter/kernels/opt-r-3.5.0/kernel.json <<EOF
{
"argv": ["$PREFIX/lib/R/bin/R", "--slave", "-e", "options(bitmapType='cairo') ; IRkernel::main()", "--args", "{connection_file}"],
"display_name": "R 3.5.0",
"language": "R"
}
EOF

this should be enough to get it to work

@its-pointless
Copy link
Owner

i guess i should do a bit of a tutorial about installing packages in julia as well at some point...

@ajrathod
Copy link

IS there any way we can check the logs ? Above fix did not work for me.

devtools::install_local('IRkernel-IRkernel-97c492b')
Installing IRkernel
Installation failed: error in running command

I installed Cairo and also made changes to kernel.json but no luck. it simply fails with error with no logs..

@hnmn
Copy link

hnmn commented Jan 26, 2019

hi there
cannot load pbdZMQ
Error : .onLoad failed in loadNamespace() for 'pbdZMQ', details: call: fun(libname, pkgname) error: Could not load /data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so : Error in dyn.load(dn.file, local = FALSE) : unable to load shared object '/data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so': dlopen failed: cannot locate symbol "R_registerRoutines" referenced by "/data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so"... ERROR: lazy loading failed for package ‘IRkernel’ removing ‘/data/data/com.termux/files/usr/lib/R/library/IRkernel

@ferroao
Copy link

ferroao commented Aug 3, 2019

After installing successfully Cairo package (except for an Rconn "no") and IRkernel, I got this while using jupyter:

unable to load shared object '/data/data/com.termux/files/usr/lib/R/library/grDevices/libs///cairo.so':
dlopen failed: cannot locate symbol "jpeg_std_error" referenced by "<...>libs/cairo.so"...
In ok_device(filename,...) : failed to load cairo DLL.

Any ideas?

@YvesAD
Copy link

YvesAD commented Aug 10, 2019

I just ran into the same issue with "libcairo":

unable to load shared object '/data/data/com.termux/files/usr/lib/R/library/grDevices/libs///cairo.so':
dlopen failed: cannot locate symbol "jpeg_std_error" referenced by "<...>libs/cairo.so"...
In ok_device(filename,...) : failed to load cairo DLL.

After 2 days of loading libraries, recompiling etc, I installed the juniper kernel:
https://github.com/JuniperKernel/JuniperKernel

Just installed from CRAN as advised in the top of the READ ME.md :

install.packages("JuniperKernel")
library(JuniperKernel)
installJuniper(useJupyterDefault = TRUE) # install into default Jupyter kernel location

Works like a charm!
(Haven't tried anything fancy yet though, only "1+1". But the kernel doesn't die !)

@miferg
Copy link

miferg commented Aug 14, 2019

HI, I am unable install IRkernel because of this error when the install.packages function tries to load pbdZMQ:

.onLoad failed in loadNamespace() for 'pbdZMQ', details:
 call: fun(libname, pkgname)
 error: Could not load /data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so : Error in dyn.load(dn.file, local = FALSE) :
 unable to load shared object '/data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so':
 dlopen failed: cannot locate symbol "R_registerRoutines" referenced by "/data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so"... 

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

No branches or pull requests

10 participants