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

Package Request: R (r-base) #250

Open
tomtom opened this issue May 4, 2016 · 155 comments
Open

Package Request: R (r-base) #250

tomtom opened this issue May 4, 2016 · 155 comments
Labels
fortran Issue is about fortran-related stuff, including gfortran. package request A new package was requested.

Comments

@tomtom
Copy link

tomtom commented May 4, 2016

Several users of GnuRoot Debian reported that R works on arm. Currently there is no other way to run R on Android.

@Neo-Oli Neo-Oli added the package request A new package was requested. label May 4, 2016
@dm319
Copy link

dm319 commented Nov 27, 2016

this would be great!

@muyang
Copy link

muyang commented Dec 2, 2016

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

@its-pointless
Copy link
Contributor

Umm https://github.com/its-pointless/gcc_termux
I actually have an experimental build of R in termux.

@namdnguyen
Copy link

namdnguyen commented May 8, 2017

@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?

@Grimler91
Copy link
Member

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

@namdnguyen
Copy link

@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?

@its-pointless
Copy link
Contributor

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.

@its-pointless
Copy link
Contributor

wait if its asking for that lib that means the executable is the old version

@its-pointless
Copy link
Contributor

no wait its arm version that is the problem my mistake

@its-pointless
Copy link
Contributor

@namdnguyen
Copy link

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.

@its-pointless
Copy link
Contributor

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

@its-pointless
Copy link
Contributor

Also if you haven't set TMP variable it will complain about not being able to create R_TempDir
...

@namdnguyen
Copy link

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

@namdnguyen
Copy link

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

@wickx
Copy link

wickx commented May 19, 2017

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

@its-pointless
Copy link
Contributor

its-pointless commented May 19, 2017

apt install libicu should be enough i will add dependency

@wickx
Copy link

wickx commented May 19, 2017

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:

  1. install termux
  2. edit your sources.list, by adding the link to the its-pointless repo (see above)
  3. add the key (i didn't bother)
  4. run an update: apt-get update
  5. install this lib: apt install libicu
  6. wait
  7. and finally: packages install r-cran

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

@namdnguyen
Copy link

namdnguyen commented May 19, 2017

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

Does anyone have any tips or ideas?

@its-pointless
Copy link
Contributor

its-pointless commented May 19, 2017

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.

@wickx
Copy link

wickx commented May 23, 2017

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

@its-pointless
Copy link
Contributor

its-pointless commented May 23, 2017

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.

@wickx
Copy link

wickx commented May 23, 2017

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.

@namdnguyen
Copy link

namdnguyen commented May 26, 2017

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.

@its-pointless
Copy link
Contributor

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.

@its-pointless
Copy link
Contributor

Also
export CONFIG_SHELL=$PREFIX/bin/sh
helps.

@cptrodolfox
Copy link

cptrodolfox commented May 31, 2017

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,

@wickx
Copy link

wickx commented May 31, 2017

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.

@cptrodolfox
Copy link

cptrodolfox commented May 31, 2017

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

@its-pointless
Copy link
Contributor

apt install gcc-8 or 9
will install it.

@its-pointless
Copy link
Contributor

also
apt install r-cran-tidyverse

@its-pointless
Copy link
Contributor

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

@linusjf
Copy link

linusjf commented Aug 26, 2019 via email

@linusjf
Copy link

linusjf commented Aug 26, 2019 via email

@linusjf
Copy link

linusjf commented Aug 27, 2019

Rscript
No output
Rscript {R script}
No output.

@its-pointless
Copy link
Contributor

so no output at all with the command Rscript?

@linusjf
Copy link

linusjf commented Aug 27, 2019 via email

@linusjf
Copy link

linusjf commented Aug 27, 2019

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.

@linusjf
Copy link

linusjf commented Aug 27, 2019

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.

@its-pointless
Copy link
Contributor

Rscript works for me...

@linusjf
Copy link

linusjf commented Aug 29, 2019

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

@its-pointless
Copy link
Contributor

Use https://its-pointless.github.io/files/24 for apt url.

@linusjf
Copy link

linusjf commented Aug 29, 2019

Is this to be updated in
/data/data/com.termux/files/usr/etc/apt/sources.list?

@linusjf
Copy link

linusjf commented Aug 30, 2019 via email

@ghost
Copy link

ghost commented Aug 31, 2019

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

@linusjf
Copy link

linusjf commented Aug 31, 2019 via email

@ghost
Copy link

ghost commented Aug 31, 2019

Remove all existing occurrences of https://its-pointless.github.io and put line posted above.

@linusjf
Copy link

linusjf commented Aug 31, 2019 via email

@linusjf
Copy link

linusjf commented Aug 31, 2019 via email

@ghost
Copy link

ghost commented Aug 31, 2019

Ok. What content of file $PREFIX/etc/apt/sources.list.d/pointless.list then ? If it exist, then you need to fix it instead.

@linusjf
Copy link

linusjf commented Aug 31, 2019

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.

@ghost
Copy link

ghost commented Aug 31, 2019

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 Package Request: R (r-base) #250 (comment) (replace means overwrite). No duplicate repositories. No API 21 & 24 mixes.

@linusjf
Copy link

linusjf commented Sep 12, 2019

Thanks for all the help. Rscript is still the same on Termux.

@xtkoba xtkoba added the fortran Issue is about fortran-related stuff, including gfortran. label Dec 4, 2022
@Abdurrashidtanha
Copy link

Why not? __

@j0hnd3v j0hnd3v mentioned this issue Jun 3, 2023
1 task
@dbech
Copy link

dbech commented Aug 31, 2023

it seems as if this briefly worked via the its pointless repo but currently doesn't work as the versions of R available in termux requires older versions of packages which are no longer available.

@jangorecki
Copy link

jangorecki commented Oct 5, 2023

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 Package Request: R (r-base) #250 (comment) (replace means overwrite). No duplicate repositories. No API 21 & 24 mixes.

Doesn't seem to work anymore.

$ R
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/R/bin/exec/R": library "libicuuc.so.69" not found: needed by main executable

@conceptrat
Copy link

now i just have to figure out the equivalent of 'gnome-open' in termux, so tht i can open pdfs directly from the terminal...

@wickx I know this was a while back, but I've only just stumbled onto this thread. You can use termux-open, or for compatibilityxdg-open, to trigger opening an external application from termux Termux Wiki - Sharing Data.

I had to follow the note at the bottom of that page and add allow-external-apps = true to the end of the file ~/.termux/termux.properties, followed by termux-reload-settings, to enable the user of external applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fortran Issue is about fortran-related stuff, including gfortran. package request A new package was requested.
Projects
None yet
Development

No branches or pull requests