5

I'm just starting my adventure with R, so every problem is a worthy challange. Unfortunately, I've updated my R to 3.6 and I had to redownload every package. And here is my problem - while instaliing rJava, my instatlation is canceled with this error:

usr/bin/ld: cannot find -lpcre2-8

I've downloaded and installed pcre2 package,but it still doesn't work. I'm working on Ubuntu 18.04

Veticus
  • 51
  • 4
  • 1
    Do `sudo apt-get install r-cran-rjava` -- it has been a part of Ubuntu for twelve years. – Dirk Eddelbuettel Jan 21 '20 at 21:51
  • Did it already - in Linux terminal it goes well, but I can't install rJava package in rstudio – Veticus Jan 21 '20 at 21:53
  • 1
    You may confuse yourself needlessly here. Under Linux, you install a package and it ends up being available everywhere. So RStudio has it as well, no need to reinstall. Just do `library(rJava)` to validate you can load it. – Dirk Eddelbuettel Jan 21 '20 at 21:57
  • Yes, but when I'm using `install.packages("rJava") in rstudio, it just crashes with this error – Veticus Jan 21 '20 at 21:59
  • To a first approximation: installation from source is _harder_ but doable. So I have been maintaining the binary package (along with other packages) for years so that users like you _don't have to install from source_. You say you already installed the binary (as a system-wide package from the distro), so maybe you could explain why you think you need to install it again? In short, you don't. If you insist on doing it anyway, read up on other questions for `libfoo-dev missing`. – Dirk Eddelbuettel Jan 21 '20 at 22:04
  • Well, I need xlsx package to open xlsx files. Problem is, that when I'm using `install.packages("xlsx")`, I'm getting this info: `package ‘rJava’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version`. This happens even after `sudo apt-get install r-cran-r-java` – Veticus Jan 21 '20 at 22:06
  • See, once you give better and more complete clues it is easier for all of us. In short, I *very strongly* recommend you install what you have, read this [README at CRAN](https://cloud.r-project.org/bin/linux/ubuntu/README.html) and pay close attention to the fourth paragraph. You can get over 4k CRAN packages for your Ubuntu installation at that PPA. – Dirk Eddelbuettel Jan 21 '20 at 22:10
  • Also, try `sudo apt-get install r-cran-openxslx` for a C++ based xlsx reader. I prefer that one for this very reason. Good luck. [PS: Edit error in previous comment, I meant _install what you have_. You need to make sure you get consistent R versions and binaries. You can get R 3.6.2 and current CRAN packages from the PPA. Or you stick with just 18.04 and do not install binaries from PPA. The `r-cran-rjava` in 18.04 will work with the R in 18,04: that is what the distro does for you. – Dirk Eddelbuettel Jan 21 '20 at 22:16
  • Ok, I'm really thankful for tips and patience. I promise that next time, I will give more details about my problems. One more time - thank you! – Veticus Jan 21 '20 at 22:21
  • No sweat---it can be overwhelming at first. And the mix between 'distro versions of CRAN package' and sources at CRAN can be confusing. We have a mailing list `r-sig-debian` for R on Debian and Ubuntu---feel free to subscribe and lurk or ask. Cheers! – Dirk Eddelbuettel Jan 21 '20 at 22:27
  • 2
    Ok, so apparently `sudo apt-get install r-base-dev` fixed the problem. I'm really greatful and I will subscirbe! – Veticus Jan 21 '20 at 22:28
  • Thanks for reporting back. Do poke around Ubuntu repos at CRAN though---I am running R from there as well to get me R 3.6.2 (current) on Ubuntu as the distro release is behind by virtue of distro snapshot (even though I run 19.10). – Dirk Eddelbuettel Jan 21 '20 at 22:31
  • I have the same problem with `CentOS Linux release 7.5.1804 (Core)` so if someone has a non-CRAN suggestion I'd be happy to hear. – Bob Jansen Jan 28 '20 at 09:59

0 Answers0