I'm trying to install packages but it doesn't work and I don't know why. I use the install.packages() function.
install.packages("ggplot2")
And then I get:
also installing the dependencies ‘isoband’, ‘rlang’
There are binary versions available but the source versions are later:
binary source needs_compilation
rlang 0.1.6 0.4.7 TRUE
ggplot2 2.2.1 3.3.2 FALSE
Do you want to install from sources the package which needs compilation?
y/n: y
and after that:
Package which is only available in source form, and may need compilation
of C/C++/Fortran: ‘isoband’
Do you want to attempt to install these from sources?
y/n: y
It doesn't matter if I select yes or no, it always does the same and in the end it says:
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in ‘/private/var/folders/87/5r3pmptj43l2kkcv9nvhqchr0000gn/T/RtmpkqxLoS/downloaded_packages’
When I then type
library(ggplot2)
I get the warning that there is no ggplot2 installed.
I used ggplot2 as an example but it is the same with any package I try to install. I'm using an older MacBook.
thanks a lot for your reply. I think it's unlikely that it's the internet connection, I have a stable connection and tried several times also after restarting the laptop and re-installing R Studio.
I've run into this type of error before, and seen others with it.
I've often found that if I individually install the packages the error message is complaining about, I'm then able to get my end-goal package installed. And if I'm struggling to get those dependencies installed, I'll at least get a bit more information about what is causing the trouble.
Windows: Also, very likely, you need to install Rtools.
These error messages ("Package which is only available in source form, and may need compilation") may mean your machine doesn't have a compiler. If that's the case, install Rtools
install.packages("isoband")
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘isoband’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘isoband’
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
100 2242k 100 2242k 0 0 6653k 0 --:--:-- --:--:-- --:--:-- 6633k
Warnung in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz)
unknown timezone 'zone/tz/2020a.1.0/zoneinfo/Europe/Zurich'
removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/isoband’
Warning in install.packages :
installation of package ‘isoband’ had non-zero exit status
The downloaded source packages are in ‘/private/var/folders/87/5r3pmptj43l2kkcv9nvhqchr0000gn/T/RtmpxvP5Pf/downloaded_packages’
And then I tried installing Xcode, but again, for that I would need to install the package "devtools" which gives the same error message... it's kind of a vicious circle :')
You don't need devtools to install XCode or Xcode Command Line Tools. Those are part of the toolchain on your OS, not part of your R installation or R packages.
I'm using an old macbook air (mid 2012, 1.8Ghz i5, 4gb, 128, Catalina 10.15.7)
I've managed to install Xcode via Appstore, but have no idea what should I do next
After described operations it possible to install packages you've mentioned: isoband and rlang(yes to compiling, but decided not to restart R from Rstudio, beacuse begins endless cycle).
> install.packages("isoband")
пробую URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/isoband_0.2.2.tgz'
Content type 'application/x-gzip' length 4016637 bytes (3.8 MB)
==================================================
downloaded 3.8 MB
The downloaded binary packages are in
/var/folders/_p/_lmvdgh976g_f1t83hx_bl9h0000gn/T//Rtmp56sEI1/downloaded_packages
> install.packages("rlang")
Error in install.packages : Updating loaded packages
Restarting R session...
> install.packages("rlang")
Error in install.packages : Updating loaded packages
Restarting R session...
> install.packages("rlang")
Error in install.packages : Updating loaded packages
Restarting R session...
> install.packages("rlang")
Error in install.packages : Updating loaded packages
Restarting R session...
> install.packages("rlang")
Error in install.packages : Updating loaded packages
> install.packages("rlang")
There is a binary version available but the source version is
later:
binary source needs_compilation
rlang 0.4.7 0.4.8 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) y
installing the source package ‘rlang’
пробую URL 'https://cran.rstudio.com/src/contrib/rlang_0.4.8.tar.gz'
Content type 'application/x-gzip' length 847517 bytes (827 KB)
==================================================
downloaded 827 KB
* installing *source* package ‘rlang’ ...
** пакет ‘rlang’ удачно распакован, MD5 sums проверены
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I./lib/ -I/usr/local/include -fPIC -Wall -g -O2 -c capture.c -o capture.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I./lib/ -I/usr/local/include -fPIC -Wall -g -O2 -c export.c -o export.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I./lib/ -I/usr/local/include -fPIC -Wall -g -O2 -c internal.c -o internal.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I./lib/ -I/usr/local/include -fPIC -Wall -g -O2 -c lib.c -o lib.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I./lib/ -I/usr/local/include -fPIC -Wall -g -O2 -c version.c -o version.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o rlang.so capture.o export.o internal.o lib.o version.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-rlang/00new/rlang/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rlang)
The downloaded source packages are in
‘/private/var/folders/_p/_lmvdgh976g_f1t83hx_bl9h0000gn/T/RtmpucH7nJ/downloaded_packages’
> libra("rlang")
Ошибка в libra("rlang") :не могу найти функцию "libra"
> library("rlang")
Ошибка: package or namespace load failed for ‘rlang’ in get(method, envir = home):
lazy-load database '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rlang/R/rlang.rdb' is corrupt
Вдобавок: Предупреждение:
В get(method, envir = home) : internal error -3 in R_decompress1
And now I finally found out what my problem was! Even though I had the newest version of Rstudio, I did not install the newest version of R (I didn't use this laptop for a few years and didn't think about updating this one).
Problem solved