Some R packages won't install
You need to install these build-dependencies for R-package:
sudo apt-get install r-base-dev
And then install R-packages to your home folder (that is ~/R/x86_64-pc-linux-gnu-library
). You do not need to run RStudio as root.
Related videos on Youtube
Addem
Updated on September 18, 2022Comments
-
Addem over 1 year
I have R version 3.4.2, trying to install
ggplot2
, raninstall.packages("ggplot2", dependencies = TRUE)
in RStudio. It eventually tells me it exited with non-zero exit status and the errors are hard to read because the message is so long, but I see that in the processMatrix
was a dependency which also failed to install, so I try to directly install that, and here's what I see in the error message for that:/usr/bin/ld: cannot find -llapack /usr/bin/ld: cannot find -lblas /usr/bin/ld: cannot find -lgfortran collect2: error: ld returned 1 exit status /usr/share/R/share/make/shlib.mk:6: recipe for target 'Matrix.so' failed make: *** [Matrix.so] Error 1 ERROR: compilation failed for package ‘Matrix’ * removing ‘/usr/local/lib/R/site-library/Matrix’
I'm not clear on what
ld
is at all and if I need to research that to solve this problem. It looks like it might alternately have something to do withMatrix.so
.-
N0rbert almost 6 yearsYou should not install R-packages system-wide. User per-user folders instead.
-
David Foerster almost 6 years@user68186: The answers to the linked duplicate question recommend the installation of
r-base-dev
among others. This package depends on the packages that provide the development files for the missing libraries. It's a duplicate indeed. -
Shubham Gupta over 3 yearsMake sure that package is using g++ or gcc and have the same version of fortran installed.
gcc --version
g++ --version
andgfortran --version
sudo apt install gfortran-8
My package used gcc. I have version 8.4.0
-
-
Addem almost 6 yearsI installed
r-base-dev
and opened RStudio, then usedinstall.packages
and it works! Thanks! I wasn't really clear on how to install the packages to my home folder--I don't see a destination option. But I'm guessing it does this by default? Anyway, since it worked, I'm guessing it's fine.