Several users of GnuRoot Debian reported that R works on arm. Currently there is no other way to run R on Android.
this would be great!
I find one way to install R.
(1) install Fedora
see https://nmilosev.svbtle.com/fedora-on-nonrooted-android-phones-2016-update
(2) install R
yum install R
*(3) install KDE
yum|dnf install @kde-desktop
Umm https://github.com/its-pointless/gcc_termux
I actually have an experimental build of R in termux.
@its-pointless thanks for sharing this! Could you describe the installation process a bit more? I tried extractions the files and then modifying the executive files permissions, but I get an error that R can't load libiconv.so.2. Should I be installing it differently?
@namdnguyen follow the instructions in @its-pointless's readme instead, or look at the detailed steps isaacullah provided in this thread.
With this, you can install it as a normal package with packages install r-cran and get updates.
@Grimler91 Thank you for the quick reply! I was able to install r-cran with isaacullah's instructions. However, I am still having some trouble getting R to run. I still get the same message, which I'll include below.
CANNOT LINK EXECUTABLE: could not load library "libiconv.so.2" needed by "/data/data/com.termux/files/usr/lib/R/bin/exec/R"; caused by library "libiconv.so.2" not found
I've tried uninstalling and reinstalling iconv to see if that would help, but it doesn't. Any ideas on what I could try next? Am I skipping a necessary step from the README without realizing it?
I will fix it later today ... to compile R needs a more functioning libiconv to compile than is in libandroid-support
Thought i made sure it was functioning.
wait if its asking for that lib that means the executable is the old version
no wait its arm version that is the problem my mistake
Thank you. I copied that to $PREFIX/lib and renamed it to libiconv.so.2 and that message went away, but then it gave a similar message and said that mempcpy was missing.
Oh im about deal with that. Its due to differences between devices since you kind of have to build this on device.
A work around is to find a lib with that has that symbol
On your device do
nm -A -D /system/lib/lib*.so | grep mempcpy
A lib with T memcpy is what you want then
LD_PRELOAD=/system/lib/libTHELIB.so R
Also if you haven't set TMP variable it will complain about not being able to create R_TempDir
...
Oh ok, no rush. I really appreciate how incredibly responsive you've been. I will wait.
I did try out the workaround you mentioned. I wasn't able to find any libs with mempcpy, but there were a lot with memcpy without the "p".
@its-pointless just to confirm, R is working for me now after the latest update. Thank you so much for your contributions! I now have R and ledger on my phone.
hi, @its-pointless, thanks for this. being able to run R on termux is fantastic.
after adding the link to the sources.list, running and update and then
packages install r-cran
the installation was really easy. unfortunately, when i try to launch R, i get this error message:
CANNOT LINK EXECUTABLE: library "libicuuc.so.59" not found page record for 0x7f81152050 was not found (block_size=64)
any ideas?
thanks again. very useful work. with termux, it's getting to the point where i won't be bound to my laptop anymore. if i could only get R to work... :)
apt install libicu should be enough i will add dependency
f** brilliant!
it's working. just did a quick install of quantmod, quandl, etc in R. couldn't be happing. it's the latest version of R as well.
i had been messing around with GNURoot Wheezy but this is far superior to anything else out there.
if anyone is wondering how to get R working on android. follow these steps:
and you'll be good to go. thanks a lot for this, @its-pointless. this is definitely better than any of the other suggestions online. and i'm glad to see people contributing to termux development, it's a game-changer
I'm having trouble installing the Rcpp package. I get this error message.
api.cpp:39:18: fatal error: 'execinfo.h' file not found
#include
Does anyone have any tips or ideas?
Android isn;t defined as an option but its easy to add defined(__ANDROID__).
https://github.com/its-pointless/gcc_termux/tree/master/R-patches
i will be putting any patches needed for r stuff there.
just another update for anyone who's having issues with R on termux. there are a lot of additional packages you need to install within termux itself, make sure you do
packages install clang
packages install libgfortran
amongst others (cant remember all of them). then, when you're in R itself, and you try to install quantmod (for instance)
install.packages('quantmod')
you'll get an error message that the gfortran command can't be found (even though you've installed libgfortran). in tht case, navigate to the
/usr/bin
directory and run this command
cp gfortran-6 gfortran
i have no idea if you're meant to do tht (??) but making a copy of this file with a title tht R recognises worked for me! i can pull financial data through quantmod and quandl and plot it inside a pdf. very happy. now i just have to figure out the equivalent of 'gnome-open' in termux, so tht i can open pdfs directly from the terminal...
yeah i probably should of added more documentation.
First thing install gcc-6 should install libgfortran. but if its not listed as a dep thats my fault.
Second point because clang is the default and gcc was removed i setup a script called setupclang and setupgcc-6 to switch between those 2 compilers. It also switches aarch64-linux-android-clang to be a symlink to gcc because of the way python configuration is set linking is sometimes done with aarch64-linux-android-clang not just just $CC. I should probably document it more but i honestly thought no one is going to use it but me so i stopped caring...
anyway if you have any further suggestions im all ears.
i'll use it! most definitely. i couldn't be happier right now. i just think a lot of people aren't aware tht this exists yet. all the various dependencies aside, getting R on android now basically comes down to installing termux and running one command.
and considering how much i use R in my day to day job, this is really invaluable. thanks.
Yes, I will second what @wickx said. It's been so helpful for me to have R available on my phone. I'm currently working on getting the tidyverse packages installed. Some of the packages installed (thanks to Rcpp and the gcc-6 compiler), but I think that others (such as stringi) require some fixes in the scripts to fix the shebang with termux-fix-shebang, and installing from source.
Yeah issue with stringi is that it uses libicu-dev which needs cxxflags -std=c++11 to work if i remember correctly. Quickest solution is to use command setupgcc-6, build and install stringi then switch back to via setupclang .
i will get a patch up in a bit.
Also
export CONFIG_SHELL=$PREFIX/bin/sh
helps.
Hello,
I am having problems to install r-cran when I try to use packages install r-cran I get the output unable to locate package r-cran. I have installed the repository and even I have installed libicu.
Thank you in advance,
hey cptrodolfox, i'm going to use emacs in this example because tht's the text editor i use. feel free to use another. to install emacs, it's
packages install emacs
then, enter the following command to edit your sources.list file, this is the file tht determines what repositories you access when you do an install or update command
emacs $PREFIX/etc/apt/sources.list
once inside the file, move your cursor to the bottom of the file, and paste this line
deb [trusted=yes] https://its-pointless.github.io/files/ termux extras
once you've done that, hit ctrl+x ctrl+s to save and then ctrl-x ctrl+c to exit emacs. after you've exited emacs, run these commands
packages update
packages install r-cran
and R should be installed. to launch R, just type the capitalised letter R on the command line and hit enter.
you'll prolly encounter more issues inside R once you start using it. report back what they are and i should be able to help you, as i currently have R running pretty flawlessly.
Hi wickx,
I have already have done that adding the repository and the key, and done the apt-get update. But, when I try packages install r-cran, It does not locate the package. It hits both repository the main termux and its-pointless one.
Thank you in advance
currently its only for arm and aaarch64.
Since its compiled on device since R no longer support cross compiling. Is your device x86?
when you do apt update could you print the output here?
Hi its-pointless,
The architecture I think is aarch64 as I have installed other packages and does was their architevture. The output of apt update is:
apt update Hit:1 http://termux.net stable InRelease
Hit:2 https://its-pointless.github.io/files termux InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Thanks in advance
i guess you could try direct download and then dpkg -i whatever.deb for now and download directly from
https://github.com/its-pointless/its-pointless.github.io/tree/master/files/dists/termux/extras/binary-aarch64
but i don't know what could be causing this.
yeh, me neither
have you tried
packages search r-cran
if you can't see it then you've probably entered the pointless repo in wrong
Hi,
The output of packages search r-cran is:
packages search r-cran
Hit:1 http://termux.net stable InRelease
Hit:2 https://its-pointless.github.io/files termux InRelease
Reading package lists... Done Building dependency tree
Reading state information... Done
All packages are up to date.
Sorting... Done
Full Text Search... Done
I finally found the error, I have a small typo at the end of the line of my source.list. Now I have installed r-cran.
Thank you,
@fornwall R has been requested by a lot of people. @its-pointless It may be wise to create a pull request.
hey @cptrodolfox
no problem. glad i could help :)
@vishalbiswas
agreed.
few reasons that is more complicated than you realize.
It needs the ndk recompiled to support fortran
It requires gcc compiler to be resurrected
it needs the gcc compiler on device to support fortran
it needs blas to be compiled. To get a good blas on arm i had to do something retarded with atlas blas otherwise its 30-40% slower.
R can only be compiled on device it hasn't supported cross compiling since 2.9 its now 3.4.
Had this conversation already.
@its-pointless @wickx i'm a researcher who's pretty new to linux - i've been trying to get r running on my pixel c for some time using gnuroot debian to no avail. Do you think one of you might find the time to post a 'how-to' on running r using termux for someone with little-to-no linux experience? I read through the posts but wasn't able to get it working.
Would be much appreciated!!
a script to do everything automatically
https://its-pointless.github.io/setup-pointless-repo.sh
Just execute this on device
sh setup-pointless-repo.sh
apt install r-cran should work then.
if you don't know how to get it on device because linux is all new
apt update
apt upgrade
then install wget
apt install wget
wget https://its-pointless.github.io/setup-pointless-repo.sh
Hi @seannossek
can you be more specific about the issue you're facing? i'd be more than happy to do a tutorial but i'm working on a few different things currently so shan't be able to do one for a while. in the meantime, i could address any specific issues you're facing...
have you tried its-pointless' suggestion above?
@its-pointless @wickx sorry I've just gotten around to trying this
its-pointless's script worked perfectly installing R, this is invaluable so i can't thank you enough.
unfortunately i'm incountering errors trying to install the package i need to use (it's a text analysis package called 'stylo')
when i attempt install i get the message that tcltk2, along with several other dependencies, are unavailable and I cannot install them. funny enough I encountered exactly this problem using the 64-bit version of R on windows (though 32- bit ran correctly), so i'm not sure if the problem is with the package or using R in termux
The tcltk library in base r-cran is used mainly for the gui elements. We don't have xwindows which means we don't have tk which means we can't load the tcltk library in R. Tcltk2 requires tcltk. So until we get x windows support working in anyway (someone is actually working on this but it uses a software renderer not the accelerated graphics in android it could load R tcltk possibly) i am afraid you are out of luck.
Hi @its-pointless, it seems like you were able to compile stringi. I think I mostly got there. I did the following steps:
setupgcc-6install.packages("/data/data/com.termux/files/home/projects/stringi", repos = NULL, type = "source") in R.It seemed to compile fine, but then I get this message at the end.
** testing if installed package can be loaded
Error: package or namespace load failed for ‘stringi’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/data/data/com.termux/files/usr/lib/R/library/stringi/libs/stringi.so':
dlopen failed: cannot locate symbol "_ZdaPvj" referenced by "stringi.so"...
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/data/data/com.termux/files/usr/lib/R/library/stringi’
Warning message:
In install.packages("/data/data/com.termux/files/home/projects/stringi", :
installation of package ‘/data/data/com.termux/files/home/projects/stringi’ had non-zero exit status
when linking appears to work but it still missing symbols either the code is wrong or the linker is wrong. My guess is its the issue with 5.1 linker. Since you have had a similar issue before but with a different symbol.
nm -A -D /system/lib/lib*.so | grep ZdaPvj
find which lib is not loading. Add it to ld flags when compiling the library. So if the missing symbol is in libcompiler_rt.so add -lcompiler_rt etc.
Thanks for this!
I got the following when trying to run R:
CANNOT LINK EXECUTABLE ".../com.termux/files/usr/lib/R/bin/exec/R": library "libandroid-glob.so" not found
Amusingly enough apt install libandroid-glob ahould fix that. I will fix dependencies so it should install properly next update.
Thanks! Works with the fix above.
Has anyone got ess (Emacs speaks statistics) working with R on termux?
Hello, I m having trouble making R start. It's complaining:
CANNOT LINK EXECUTABLE: cannot locate symbol "mempcpy" referenced by "/data/data/com.termux/files/usr/lib/R/bin/exec/R"...
I think I have installed all the packages discussed on this page (libgfortran, clang, gcc-6...) and all their dependencies.
The command nm -A -D /system/lib/lib*.so | grep mempcpy does not return anything. Could somebody tell me in which package function mempcpy is? Thanks.
Which arch you using im doing updates eight now?
aarch64 or arm?
Thanks for your quick reaction. My phone is aarch64.
Damn dude you are the first person iv encountered with aarch64 still using android 5.1 in ages. I will find a solution tommorow. There is a funny hack you can use to get around this by preloading octave libs since it uses the libgnu during build so it has mempcpy.
I m on 5.0... the phone is rooted and I have to unroot it to upgrade. Last time I tried I nearly bricked it so I'm keeping 5.0...
if you could download R_aarch64_and_5.1_fixv1.zip and replace the R binary /data/data/com.termux/files/usr/lib/R/bin/exec/R and tell me if it works?
It works! Thank you very much. Should I pin the package to block updates or will you include the patch in the package? Thanks again.
@its-pointless, Hello, first thanks a lot for porting R in termux. I was able to run R but could not install Rcpp. I dont know how to apply patch. I know I could do "patch < patchfile" but no idea which folder to run. I would highly appreciate any help. @namdnguyen, how did u solve Rcpp problem? Can u please help?
Never mind, I finally could run the patch but its Hunk 1 FAILED at 33/33. I downloaded the Rcpp package from R with download.package command. What should I do now?
I have solved Rcpp and stringi problems. But could not install bindrcpp which is a dependency of dplyr. Any thoughtS?
Okay, after some trial and tribulation bindrcpp and dplyr is out of the way. But got stuck at installing the package "curl". It says configuration failed for package 'curl'. How to fix that?
It says "Configuration failed because libcurl was not found". But I tried curl google.com, it just worked fine.
@rfaridi do you have libcurl-dev installed? pkg install libcurl-dev
@its-pointless @wickx @namdnguyen Do you know whether its possible to install all the packages in tidyverse? I got just stuck at "curl" package. Please help if possible.
Install libcurl-dev in termux then try installing curl in R ... should work
_Sent from my Htc HTC 2PS6200 using FastHub_
@Grimler91 @its-pointless , thanks guys, it works!
Now ran into openssl and xml2. For openssl, I tried to install libssl-dev but it was not found. For xml2, I installed libxml2-dev but it still did not work. Any ideas? @Grimler91 @its-pointless
@rfaridi Well apt search openssl finds the package openssl-dev so that's probably a good bet.
For libxml2 you may have to do a symlink as in this issue: #1142.
@Grimler91 , thanks openssl working now but still stuck with xml2. Did the symlink, installed all the related packges mentioned in the thread but still no go :-( , anyone had any luck with this?
@rfaridi What error do you get? Post/upload the log
The error output is pretty short:
sh: ./configure: No such file or directory
ERROR: configuration failed for package 'xml2'
@rfaridi Can't really debug that. Try finding which lines of code that generates it.
Anyone was able to run R code in neovim, with nvim-r plugin? I could not send codes from script to console, nvimcom installation failed. Anyone tried that? @its-pointless @Grimler91 @namdnguyen
I am getting errors when trying to install.packages ("XML") within R on android. It does not seem to be a dependency or package error. Can anyone help ?
usr/include/libandroid-support -fpic -g -O2 -c xpath.c -o xpath.o xpath.c:37:41: warning: passing 'const xmlChar *' (aka 'const unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign] ...ScalarString(mkCharCE(el->name, encod... ^~~~
/Rdefines.h:155:57: note: expanded from macro 'SET_NAMES' ...Rf_setAttrib(x, R_NamesSymbol, n) ^ /data/data/com.termux/files/usr/lib/R/include/Rinternals.h:938:30: note: passing argument to parameter here SEXP Rf_mkCharCE(const char , cetype_t); ^
1 warning generated. gcc -shared -lpng -ljpeg -ltiff -lcurl -lpcre -landroid-support -landroid-glob -lm -lgfortran -lopenblas -lgnuiconv -llzma -o XML.so DocParse.o EventParse.o ExpatParse.o HTMLParse.o NodeGC.o RSDTD.o RUtils.o Rcatalog.o Utils.o XMLEventParse.o XMLHashTree.o XMLTree.o fixNS.o libxmlFeatures.o schema.o xmlsecurity.o xpath.o -L/data/data/com.termux/files/usr/lib -lxml2 -lz -L/data/data/com.termux/files/usr/lib -llzma -liconv -lm -lz -lxml2 -L/data/data/com.termux/files/usr/lib -lxmlsec1-openssl -lxmlsec1 -lz -llzma -liconv -lxslt -lxml2 -lm -lssl -lcrypto /data/data/com.termux/files/usr/bin/ld: cannot find -lgfortran
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make: ** [/data/data/com.termux/files/usr/lib/R/share/make/shlib.mk:6: XML.so] Error 1 ERROR: compilation failed for package ‘XML’ * removing ‘/usr/lib/R/library/XML’ The downloaded source packages are in ‘/data/data/com.termux/files/
do you have libgfortran4 not installed?
is the libgfortran.so symlink in $PREFIX/lib missing?
Yes i have libgfortran4 installed. In my lib directory i see :
libgfortran.so.3 libgfortran.so.4.0.0
libgfortran.so.3.0.0 libgfortran.spec
libgfortran.so.4
You are right there is no symlink in $PREFIX/lib in my system. Can you advise which version of the libgfortran i should create a symlink with ?
Tks.
with libfortran.so.4.0.0
Excellent and thank you very much. All working now. Cheers.
After installing r-cran package and trying to run as R, got the following message:
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/R/bin/exec/R": library "libopenblas.so" not found
Aborted
Any ideas?
@starlinq I'm guess that installing openblas will help since libopenblas.so seem to be missing.
pacman -S r installs R in Arch Linux in Termux PRoot. R installs with a small r, not a capital one (r-3.4.2-3 installs at present to be precise). See https://sdrausty.github.io/TermuxArch/ for more information about how to install Arch Linux in Termux. Use a capital R to run it:

Thank you for the responses. I have solved the issue with command:
pkg install openblas
It is amazing, now I can run R version 3.4.2. I am using a capital letter in command line:
R
I can even install IRkernel and have R run on jupyter notebook. Previously I had problem with unavailability of X11 but after last upgrade everything works fine. Thanks to the developers.
@rfaridi what did you do to get bindrcpp to work?
R installs with relevant instructions in pointless.repo..apt-transport not available
But on running there is seg-fault with invalid permissions
Arch64 with 5.1.1
Invalid permissions?
Whats the exact error?
Are you running in another directory not your home dir?
i will remove https apt stuff from instuctions and scripts as its not longer needed.
Here is the console output when I start R..Have done install 3-4 times with same result..
I am on 5.1.1 64bit,
R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
* caught segfault *
address 0x7f8b05abc8, cause 'invalid permissions'
Traceback:
1: .select_device()
2: fun(libname, pkgname)
3: doTryCatch(return(expr), name, parentenv, handler)
4: tryCatchOne(expr, names, parentenv, handlers1L)
5: tryCatchList(expr, classes, parentenv, handlers)
6: tryCatch(fun(libname, pkgname), error = identity)
7: runHook(".onLoad", env, package.lib, package)
8: loadNamespace(package, lib.loc)
9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers1L)
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) { P <- if (!is.null(cc <- conditionCall(e))) paste(" in", deparse(cc)[1L]) else "" msg <- gettextf("package or namespace load failed for %s%s:\n %s", sQuote(package), P, conditionMessage(e)) if (logical.return) message(paste("Error:", msg), domain = NA) else stop(msg, call. = FALSE, domain = NA)})
13: library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, warn.conflicts = warn.conflicts, quietly = quietly)
14: doTryCatch(return(expr), name, parentenv, handler)
15: tryCatchOne(expr, names, parentenv, handlers1L)
16: tryCatchList(expr, classes, parentenv, handlers)
17: tryCatch(library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, warn.conflicts = warn.conflicts, quietly = quietly), error = function(e) e)
18: require(pkg, quietly = TRUE, warn.conflicts = FALSE, character.only = TRUE)
19: .First.sys()
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
iv tried quickly reproducing on a android 5 rom and can't im going to have a closer look. But android 5 libc behavior can often have bugs specific to that rom for a specific manufactored device. For instance if a command line entered is too long it trunicates only using 100 characters sometimes less. Most android 5 roms aren't affected to that degree but some are. I can't gurantee i can fix it even if i can find the cause.
After recent updates I cannot run R
$ R
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/R/bin/exec/R": cannot locate symbol "__muldc3" referenced by "/data/data/com.termux/files/usr/lib/R/bin/exec/R"...
Aborted
Found a solution in another thread:
export LD_PRELOAD=/system/lib/libcompiler_rt.so
I can install R using the instructions provided, but am struggling to install ANY additional packages. For example
install.packages('zoo')
Results in
sh: make: not found
ERROR: compilation failed for package 'zoo'
Any help would be appreciated.
you need to install make? I provide zoo package via apt anyway. As well
rcpp, stringi and rquantlib.
On 3 Apr. 2018 10:39 pm, "david-macleod" notifications@github.com wrote:
I can install R using the instructions provided, but am struggling to
install ANY additional packages. For example
install.packages('zoo')
Results in
sh: make: not found
ERROR: compilation failed for package 'zoo'
Any help would be appreciated.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/250#issuecomment-378235265,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AP-Ot8gekkxN3xl0-dX_a_0BCFVKdsPLks5tk22HgaJpZM4IXFrE
.
So simple! Thank you
Hello,
Here is the error I have when trying to run R in termux
$ R
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/R/bin/exec/R": cannot locate symbol "catgets" referenced by "/data/data/com.termux/files/usr/lib/R/bin/exec/R"...
Aborted
$
I followed the instructions regarding the libs, reinstalled termux two times already...
Here is the output from temux-info
$ termux-info
Updatable packages: All packages up to date
System information: Linux localhost 3.10.84-13024869 #1 SMP PREEMPT Tue Feb 6 16:13:51 KST 2018 aarch64 Android
Termux-packages arch: aarch64
Android version: 7.0
Device manufacturer: samsung
Device model: SM-T719
$
Thanks for your work.
I am very enthousiast about having a R working on my tablet.
Yours Yves D
Fixed.
Im compiling using omp. Omp that llvm uses uses nl unicode etc. To use with android which doesn't have that android made a nlstubbs.cpp so it would work. Because im using android 8 on this tue libc.so has getcats which is a unicode nl function. So instead of linking the stubbs it linked the real thing from my libc.so on phone.
To fix i just linked libomp.a with the whole archive so the stubbs is used instead and R is not linked
catgets undefined.
WoW,
that was quick!
It is working now.
Just had to do a "pkg upgrade".
Thanks a lot.
I am physicist mostly teaching math nowadays.
I wanted my pupils to be able to do some serious stats on their phones or tablets
Thanks to you it will be fun next week!
Yours
Yves Delhaye
In R, when I try install.packages('rnormt'), I get the following:
I don't know Linux well, but I've followed all the recommendations I could find. (That might be my problem! Maybe I followed conflicting instructions. :D)
I've got the following in $PREFIX/lib:
libgfortran.so
libgfortran.so.3
libgfortran.so.3.0.0
libgfortran.so.4
libgfortran.so.4.0.0
Someone mentioned heading into $PREFIX/bin and copying gfortran-6 to gfortran, but there's no gfortran-6 (or anything looking like gfortran) in $PREFIX/bin.
Any pointers on what to try next? My overall goal was to get tidyverse on my phone (Android One Moto X4), and when it failed I'd decided to walk through the failed dependencies one by one. This one's stumped me.
Its not finding the fortran compiler.
Simple solution is to use the scripts i added to setup different compilers
the command setupclang-gfort-7
This will add a symlink from gfortran-7 to gfortran
It will then find that command when you use R.
I have the latest R (3.4.4?) running in termux. I would love to use the 'rtichoke' R console, but it fails to 'find R shared library' (libR.so). I believe this requires building with ./configure --enable-R-shlib before make, and it is a common problem with R Studio users. Is this possible with R for termux?
Huge thank you to its-pointless. You are helping to spread gnu/linux goodness to all these arm devices!
I have just successfully installed R with library(tidyverse). I added your repository, 'apt install r-base' and then 'apt install gcc-6' and then used the setupgcc6 command to allow installation of library(mnormt).
I copied these instructions for installing stringi/icudata from here, manually downloading the zip file:
@Dieter.Wilhelm The INSTALL documentation for stringi states: If you decide to use our ICU4C bundle then, by default, the ICU data library will be downloaded from one of our mirror servers. However, if you have already downloaded a version of icudt*.zip suitable for your platform (big/little endian), you may wish to install the package by calling: install.packages("stringi", configure.vars="ICUDT_DIR=
") You can then put the already downloaded zip wherever you'd like and refer to it in – danh Oct 17 '17 at 19:11
There is probably a better way to do it, but it worked.
I've also installed neovim, vim-plug and the excellent nvim-R plugin. If you haven't come across it, it is a bit like RStudio for vim.
Now R (and Julia) are pretty much in my pocket. This is terrific and kinda unbelievable! Thanks again!
A pic for inspiration / motivation:
If it is of use to anyone who stumbles upon this thread, I've prepared a write-up for a full install of the tidyverse and Nvim-R https://conr.ca/post/installing-r-on-android-via-termux/
@ConorIA your thread has been shared here.
Hi
I tried the instructions on that website and many others so far I have been unable to install tidyverse
on a Android tablet (Samsung sm-p355) running Android 7.1.1
The first package that tries to install fs gives the following error:
id.cc:73:17 error: use of undeclared identifier 'getpwent'; did you mean 'getgrent'?
I have tried installing Rcpp from r-cran-rcpp, and using install.packages. Also tried all versions of clang that were available (setupclang, setupclang-gfort-8, ..., setupclang-gfort-6) but I still get the same error when installing the fs package.
by the way what is that setup-patchforgcc for?
thanks
F
I also tried installing dplyr after using setupclang and it compiles without error. However at the end I get the following error:
** testing if installed package can be loaded
Error: package or namesapce load failed for 'dplyr' in dyn.load(file,DLLpath=DLLpath,...):
unable to load shared object '/data/data/com.termux/files/usr/lib/R/library/dplyr/libs/dplyr.so':
dlopen failed: cannot locate symbol "__atomic_fetch_sub_4" referenced by "/data/data/com.termux/files/usr/lib/R/library/dplyr/libs/dplyr.so"...
Error: loading failed
Execution halted
@fkgruber
The first package that tries to install fs gives the following error: id.cc:73:17 error: use of undeclared identifier 'getpwent'
You need to patch fs to not use getpwent. That function doesn't exist on android as it is a single user environment. See for example here for another package that patches it.
dlopen failed: cannot locate symbol "__atomic_fetch_sub_4"
Might be fixable by adding -latomic to a suitable compiler flag. Some other packages need this for the i686 architecture, for example imagemagick. The error might also be related to issue https://github.com/termux/termux-packages/issues/3092, if you are on arm
thanks.
I will take a look at those links. I'm surprised that there is not quick fix right now. Specially since it appears that many android users have been able to install tidyverse with termux.
@fkgruber
The first package that tries to install fs gives the following error: id.cc:73:17 error: use of undeclared identifier 'getpwent'
You need to patch fs to not use getpwent. That function doesn't exist on android as it is a single user environment. See for example here for another package that patches it.
dlopen failed: cannot locate symbol "__atomic_fetch_sub_4"
Might be fixable by adding
-latomicto a suitable compiler flag. Some other packages need this for the i686 architecture, for example imagemagick. The error might also be related to issue #3092, if you are on arm
yeah things change within R packages as well. I am looking for a better solution now.
k managed to compile tidyverse.
"33M r-cran-tidyverse_1.0.0_aarch64.deb"
this would make things easier i guess?
you mean so we can do pkg install r-cran-tidyverse?
That would be fantastic.
Yes uploading now
just installed it thanks a lot.
Yes uploading now
I am Chinese students,not good at English,When I use termux run R program have error,my phone is oneplus3T,Could you give me solve?This problem is about use R to install packages.
When I run R (not use root),use library() command,will report is problems,
sh: /data/data/com.termux/files/usr/lib/R/bin/pager: can't execute: Permission denied
I try use like chmod 777 command ,but is not useful.
And then I try tsu(use root),When I input R,will report is problems,
Fatal error: cannot create 'R_TempDir'
I try google or baidu is not useful.
Please help me,thanks~
New issue after termux updates
$ R
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/R/bin/exec/R": library "libicuuc.so.63" not found
Aborted
I will get around to it today.
@its-pointless Thank you for your work. The issue has been fixed.
I cannot install IRkernel
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’
The downloaded source packages are in
‘/data/data/com.termux/files/usr/tmp/RtmpiuQQaD/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
@qinhaolan You are hitting https://github.com/android-ndk/ndk/issues/201 which is Android's linker issue with RTLD_GLOBAL dlopen flag.
New errors after recent R update to version 3.6.0
`
$ R
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: armv7-unknown-linux-androideabi (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
Error: package or namespace load failed for ‘utils’:
.onLoad failed in loadNamespace() for 'utils', details:
call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
error: error in running command
Error: package or namespace load failed for ‘stats’:
.onLoad failed in loadNamespace() for 'utils', details:
call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
error: error in running command
During startup - Warning messages:
1: package ‘utils’ in options("defaultPackages") was not found
2: package ‘stats’ in options("defaultPackages") was not found
`
@Starlinq that is caused by using the wrong repo
Instead of https://its-pointless.github.io/files
Use https://its-pointless.github.io/files/24 in etc/apt/source.list or in etc/apt/source.list.d/
error can also caused by a screw up by me will fix in a bit.
@its-pointless any update? still getting the same error...
if you could show me output from the command
termux-info
that would help
oh, sorry, here you go:
$ termux-info
All packages up to date
Subscribed repositories:
https://dl.bintray.com/xeffyr/x11-packages-21 x11/main
https://dl.bintray.com/grimler/science-packages-21 science/stable
https://dl.bintray.com/grimler/termux-root-packages-21 root/stable
https://its-pointless.github.io/files termux/extras
https://its-pointless.github.io/files termux/extras
https://dl.bintray.com/grimler/game-packages-21 games/stable
https://termux.net stable/main
https://termux.net stable/main
System information:
Linux localhost 4.9.59-16141281 #1 SMP PREEMPT Mon Jul 1 21:34:34 KST 2019 aarch64 Android
Termux-packages arch:
aarch64
Android version:
9
Device manufacturer:
samsung
Device model:
SM-N960F
I'm unable to run Rscript on Termux. You specify a file, yet it displays no output. R CMD BATCH works as expected. Additionally, gfortan's unavailability led me to install R on Arch Linux on Termux. Rscript works as expected there.
Gfortran is available. R wouldn't compile without it without it.
Installing gcc-8 or gcc-9 etc comes with gfortran.
On Arch Linux on Termux, it is.
Try installing package igraph on Termux R.
It falls over with a message that gfortran is not available.
Additionally, the help on R Termux in the R console is askew. The first page or so displays perfectly but when you scroll down, the screen narrows down to 1/3rd of the column size and characters to the right are no longer visible.
I've installed all three versions of libgfortran. gfortran is still not available.
There's also this. https://github.com/termux/termux-packages/issues/702
If R is not to be supported fully, it might as well be dropped from the
termux repo. Or you should port the packages that require gfortran to C or
C++.
Julia is available on Termux. Perversely, it's not on Arch Linux for Termux.
apt install gcc-8 or 9
will install it.
also
apt install r-cran-tidyverse
also to switch to a specific compiler as default:
setupclang-gfort-9
or setupgcc-9
etc
if you intend on trying to use gcc as c compiler
setup-patchforgcc to patch headers so it will mostly work...
Thanks. That worked.
lintr and igraph are now installed cleanly.
igraph compilation fails with setupgcc-8 with the patch installed.
Setting clang to the default works for compilation of the above packages.
I still can't get Rscript, the command, to work as expected. It does
nothing without or with a script as parameter. Is this broken? Do I need to
reinstall R?
Rscript
No output
Rscript {R script}
No output.
so no output at all with the command Rscript?
Not on Termux.
I'm running the scripts via:
R CMD BATCH --slave {script}
Stackoverflow says that's not the preferred method of running scripts any
more.
Rscript appears to be an ELF executable. If its not working, Termux could simply wrap the above in a script and output the .Rout file to stdout. That's how ecj is defined on Termux, anyway.
Am I missing something? I haven't the time to troubleshoot this issue myself. R works fine on Arch Linux (Termux) for me and I'm just getting started with the R environment.
Rscript works for me...
It doesn't for me and it never has.
termux-info
Updatable packages:
nodejs/stable 12.9.1 aarch64 [upgradable from: 12.9.0]
Subscribed repositories:
https://dl.bintray.com/xeffyr/x11-packages-24 x11/main
https://dl.bintray.com/xeffyr/unstable-packages-24 unstable/main
https://dl.bintray.com/grimler/science-packages-24 science/stable
https://dl.bintray.com/grimler/termux-root-packages-24 root/stable
https://its-pointless.github.io/files termux/extras
https://its-pointless.github.io/files termux/extras
https://dl.bintray.com/grimler/game-packages-24 games/stable
https://dl.bintray.com/termux/termux-packages-24 stable/main
System information:
Linux localhost 3.18.31-perf-ga8bf568 #1 SMP PREEMPT Tue Jul 9 11:22:23 WIB 2019 aarch64 Android
Termux-packages arch:
aarch64
Android version:
7.1.2
Use https://its-pointless.github.io/files/24 for apt url.
Is this to be updated in
/data/data/com.termux/files/usr/etc/apt/sources.list?
Reading package lists... Done
E: The repository 'https://its-pointless.github.io/files/24 stable Release'
does not have a Release file.
I updated the sources.list with the above url but have the above error.
On Fri, 30 Aug 2019, 02:24 its-pointless, notifications@github.com wrote:
Use https://its-pointless.github.io/files/24 for apt url.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/250?email_source=notifications&email_token=AF4R3PIGKROAS5PTKIFRQKTQHAZRNA5CNFSM4CC4LLCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5PZGPI#issuecomment-526357309,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF4R3PJJKCPTVXWOR35QW6LQHAZRNANCNFSM4CC4LLCA
.
E: The repository 'https://its-pointless.github.io/files/24 stable Release'
The correct sources.list line should be:
deb https://its-pointless.github.io/files/24 termux extras
as repository doesn't have deb distribution "stable".
So should I retain the original line and append this?
On Sat, 31 Aug 2019, 16:46 Leonid Plyushch, notifications@github.com
wrote:
E: The repository 'https://its-pointless.github.io/files/24 stable
Release'The correct sources.list line should be:
deb https://its-pointless.github.io/files/24 termux extras
as repository doesn't have deb distribution "stable".
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/250?email_source=notifications&email_token=AF4R3PIIRX6EGTTHNURPMWLQHJHIPA5CNFSM4CC4LLCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5TKXDY#issuecomment-526822287,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF4R3PMIIRB2SULBHQYWKYTQHJHIPANCNFSM4CC4LLCA
.
Remove all existing occurrences of https://its-pointless.github.io and put line posted above.
Adding the line works. But Rscript still doesn't.
There was only one line in the original file.
deb https://dl.bintray.com/termux/termux-packages-24 stable main
On Sat, 31 Aug 2019, 19:55 Leonid Plyushch, notifications@github.com
wrote:
Remove all existing occurrences of https://its-pointless.github.io and
put line posted above.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/termux/termux-packages/issues/250?email_source=notifications&email_token=AF4R3PKVSW5PJTBXTCVP2DLQHJ5OPA5CNFSM4CC4LLCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5TNXNA#issuecomment-526834612,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF4R3PP5HYPXKNLVUO34OKLQHJ5OPANCNFSM4CC4LLCA
.
Ok. What content of file $PREFIX/etc/apt/sources.list.d/pointless.list then ? If it exist, then you need to fix it instead.
OK. What's supposed to happen? A whole set of packages including R-base, Julia and scipy were downloaded earlier by changing the sources.list file. Updating the pointless.list produces a duplicate configuration error. So I reverted the sources.list to the original one and tried a pkg up. No new packages are downloaded. Rscript is the same.
Remove the its-pointless repo from original sources.list and update the line in pointless.list.
So what should happen:
$PREFIX/etc/apt/sources.list is clean. Only the main Termux repo should be here.
$PREFIX/etc/apt/sources.list.d/pointless.list should point to API 24 repo. Replace content with line from https://github.com/termux/termux-packages/issues/250#issuecomment-526822287 (replace means overwrite). No duplicate repositories. No API 21 & 24 mixes.
Thanks for all the help. Rscript is still the same on Termux.
Most helpful comment
Thank you for the responses. I have solved the issue with command:
pkg install openblasIt is amazing, now I can run R version 3.4.2. I am using a capital letter in command line:
Rscreenshot