gcc_termux icon indicating copy to clipboard operation
gcc_termux copied to clipboard

Installing R kernel for Jupyter notebook

Open yoshimoncho opened this issue 6 years ago • 15 comments

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

yoshimoncho avatar Dec 11 '17 02:12 yoshimoncho

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!

namdnguyen avatar Jan 14 '18 18:01 namdnguyen

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!

clancia avatar Mar 20 '18 23:03 clancia

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.

namdnguyen avatar Apr 13 '18 16:04 namdnguyen

Appreciated. Thank you very much.

Il ven 13 apr 2018, 18:02 Nam D. Nguyen [email protected] ha scritto:

Hi @clancia https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/its-pointless/gcc_termux/issues/25#issuecomment-381182477, or mute the thread https://github.com/notifications/unsubscribe-auth/AH8bJTy1gExniwQo57Z6yQCEQoTK5C_Hks5toMwQgaJpZM4Q8yLK .

--

Carlo Lancia, PhD

Mathematical Institute Leiden University DASPO Group sites.google.com/view/daspo

clancia avatar Apr 13 '18 16:04 clancia

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

richgoldberg avatar May 26 '18 17:05 richgoldberg

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.

richgoldberg avatar May 26 '18 19:05 richgoldberg

Thank you very much. I will try.

Il giorno sab 26 mag 2018 alle ore 21:16 Rich [email protected] ha scritto:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/its-pointless/gcc_termux/issues/25#issuecomment-392282559, or mute the thread https://github.com/notifications/unsubscribe-auth/AH8bJcMY6Tp8E2vsF_QTM9L8YDmvfZN7ks5t2an6gaJpZM4Q8yLK .

--

Carlo Lancia, PhD

Mathematical Institute Leiden University DASPO Group sites.google.com/view/daspo

clancia avatar May 26 '18 20:05 clancia

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 avatar Aug 10 '18 07:08 its-pointless

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 avatar Aug 10 '18 07:08 its-pointless

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

its-pointless avatar Aug 10 '18 07:08 its-pointless

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..

ajrathod avatar Sep 16 '18 19:09 ajrathod

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

hnmn avatar Jan 26 '19 09:01 hnmn

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?

ferroao avatar Aug 03 '19 05:08 ferroao

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 !)

YvesAD avatar Aug 10 '19 10:08 YvesAD

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"... 

miferg avatar Aug 14 '19 22:08 miferg