R -- unable to install "tidyverse" packages - r

I tried installing "tidyverse" (and many other packages) and it didn't work!!
I have googled and read a bunch of solutions that people have given to similar problems and I tried them (e.g., redownloading R, Rstudio; go to tool > global option and uncheck http; etc.) but they didn't work either. Below is what I can see when tried:
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.
Natural language support but running in an English locale
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.
> install.packages("tidyverse")
also installing the dependencies ‘markdown’, ‘rlang’, ‘knitr’, ‘base64enc’, ‘tidyselect’, ‘Rcpp’, ‘isoband’, ‘vctrs’, ‘fs’, ‘rmarkdown’, ‘broom’, ‘dbplyr’, ‘dplyr’, ‘ggplot2’, ‘haven’, ‘hms’, ‘lubridate’, ‘modelr’, ‘reprex’, ‘tidyr’, ‘xml2’
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'
Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘markdown’ ‘rlang’
‘base64enc’ ‘tidyselect’ ‘Rcpp’ ‘isoband’ ‘vctrs’ ‘fs’ ‘dplyr’ ‘haven’ ‘lubridate’ ‘tidyr’ ‘xml2’
Do you want to attempt to install these from sources? (Yes/no/cancel) yes
installing the source packages ‘markdown’, ‘rlang’, ‘knitr’, ‘base64enc’, ‘tidyselect’, ‘Rcpp’, ‘isoband’, ‘vctrs’, ‘fs’, ‘rmarkdown’, ‘broom’, ‘dbplyr’, ‘dplyr’, ‘ggplot2’, ‘haven’, ‘hms’, ‘lubridate’, ‘modelr’, ‘reprex’, ‘tidyr’, ‘xml2’, ‘tidyverse’
trying URL 'https://cran.rstudio.com/src/contrib/markdown_1.1.tar.gz'
Content type 'application/x-gzip' length 81050 bytes (79 KB)
==================================================
downloaded 79 KB
trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.4.5.tar.gz'
Content type 'application/x-gzip' length 816813 bytes (797 KB)
==================================================
downloaded 797 KB
trying URL 'https://cran.rstudio.com/src/contrib/knitr_1.28.tar.gz'
Content type 'application/x-gzip' length 884866 bytes (864 KB)
==================================================
downloaded 864 KB
trying URL 'https://cran.rstudio.com/src/contrib/base64enc_0.1-3.tar.gz'
Content type 'application/x-gzip' length 7833 bytes
==================================================
downloaded 7833 bytes
trying URL 'https://cran.rstudio.com/src/contrib/tidyselect_1.0.0.tar.gz'
Content type 'application/x-gzip' length 151161 bytes (147 KB)
==================================================
downloaded 147 KB
trying URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.4.tar.gz'
Content type 'application/x-gzip' length 2750216 bytes (2.6 MB)
==================================================
downloaded 2.6 MB
trying URL 'https://cran.rstudio.com/src/contrib/isoband_0.2.0.tar.gz'
Content type 'application/x-gzip' length 1894070 bytes (1.8 MB)
==================================================
downloaded 1.8 MB
trying URL 'https://cran.rstudio.com/src/contrib/vctrs_0.2.4.tar.gz'
Content type 'application/x-gzip' length 787455 bytes (768 KB)
==================================================
downloaded 768 KB
trying URL 'https://cran.rstudio.com/src/contrib/fs_1.3.2.tar.gz'
Content type 'application/x-gzip' length 820272 bytes (801 KB)
==================================================
downloaded 801 KB
trying URL 'https://cran.rstudio.com/src/contrib/rmarkdown_2.1.tar.gz'
Content type 'application/x-gzip' length 3186382 bytes (3.0 MB)
==================================================
downloaded 3.0 MB
trying URL 'https://cran.rstudio.com/src/contrib/broom_0.5.5.tar.gz'
Content type 'application/x-gzip' length 1223871 bytes (1.2 MB)
==================================================
downloaded 1.2 MB
trying URL 'https://cran.rstudio.com/src/contrib/dbplyr_1.4.2.tar.gz'
Content type 'application/x-gzip' length 303397 bytes (296 KB)
==================================================
downloaded 296 KB
trying URL 'https://cran.rstudio.com/src/contrib/dplyr_0.8.5.tar.gz'
Content type 'application/x-gzip' length 1378766 bytes (1.3 MB)
==================================================
downloaded 1.3 MB
trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.3.0.tar.gz'
Content type 'application/x-gzip' length 3031461 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
trying URL 'https://cran.rstudio.com/src/contrib/haven_2.2.0.tar.gz'
Content type 'application/x-gzip' length 272575 bytes (266 KB)
==================================================
downloaded 266 KB
trying URL 'https://cran.rstudio.com/src/contrib/hms_0.5.3.tar.gz'
Content type 'application/x-gzip' length 134669 bytes (131 KB)
==================================================
downloaded 131 KB
trying URL 'https://cran.rstudio.com/src/contrib/lubridate_1.7.4.tar.gz'
Content type 'application/x-gzip' length 449850 bytes (439 KB)
==================================================
downloaded 439 KB
trying URL 'https://cran.rstudio.com/src/contrib/modelr_0.1.6.tar.gz'
Content type 'application/x-gzip' length 121295 bytes (118 KB)
==================================================
downloaded 118 KB
trying URL 'https://cran.rstudio.com/src/contrib/reprex_0.3.0.tar.gz'
Content type 'application/x-gzip' length 1052597 bytes (1.0 MB)
==================================================
downloaded 1.0 MB
trying URL 'https://cran.rstudio.com/src/contrib/tidyr_1.0.2.tar.gz'
Content type 'application/x-gzip' length 812005 bytes (792 KB)
==================================================
downloaded 792 KB
trying URL 'https://cran.rstudio.com/src/contrib/xml2_1.2.5.tar.gz'
Content type 'application/x-gzip' length 273448 bytes (267 KB)
==================================================
downloaded 267 KB
trying URL 'https://cran.rstudio.com/src/contrib/tidyverse_1.3.0.tar.gz'
Content type 'application/x-gzip' length 712837 bytes (696 KB)
==================================================
downloaded 696 KB
* installing *source* package ‘markdown’ ...
** package ‘markdown’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c Rbase64.c -o Rbase64.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from Rbase64.c:1:
In file included from ./Rmarkdown.h:14:
/Library/Frameworks/R.framework/Resources/include/R.h:55:11: fatal error: 'stdlib.h' file not found
# include <stdlib.h> /* Not used by R itself, but widely assumed in packages */
^~~~~~~~~~
1 error generated.
make: *** [Rbase64.o] Error 1
ERROR: compilation failed for package ‘markdown’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/markdown’
Warning in install.packages :
installation of package ‘markdown’ had non-zero exit status
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I./lib/ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c capture.c -o capture.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from capture.c:1:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
^~~~~~~~~
1 error generated.
make: *** [capture.o] Error 1
ERROR: compilation failed for package ‘rlang’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rlang’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rlang’
Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status
* installing *source* package ‘base64enc’ ...
** package ‘base64enc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c base64.c -o base64.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from base64.c:86:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
^~~~~~~~~
1 error generated.
make: *** [base64.o] Error 1
ERROR: compilation failed for package ‘base64enc’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/base64enc’
Warning in install.packages :
installation of package ‘base64enc’ had non-zero exit status
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c api.cpp -o api.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from api.cpp:24:
In file included from ../inst/include/Rcpp.h:27:
In file included from ../inst/include/RcppCommon.h:29:
In file included from ../inst/include/Rcpp/r/headers.h:67:
In file included from ../inst/include/Rcpp/platform/compiler.h:100:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:305:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/math.h:301:15: fatal error: 'math.h' file not found
#include_next <math.h>
^~~~~~~~
1 error generated.
make: *** [api.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp’
Warning in install.packages :
installation of package ‘Rcpp’ had non-zero exit status
ERROR: dependency ‘markdown’ is not available for package ‘knitr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/knitr’
Warning in install.packages :
installation of package ‘knitr’ had non-zero exit status
ERROR: dependency ‘Rcpp’ is not available for package ‘isoband’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/isoband’
Warning in install.packages :
installation of package ‘isoband’ had non-zero exit status
* installing *source* package ‘vctrs’ ...
** package ‘vctrs’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c altrep-rle.c -o altrep-rle.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from altrep-rle.c:1:
In file included from ./vctrs.h:6:
/Library/Frameworks/R.framework/Resources/include/R.h:55:11: fatal error: 'stdlib.h' file not found
# include <stdlib.h> /* Not used by R itself, but widely assumed in packages */
^~~~~~~~~~
1 error generated.
make: *** [altrep-rle.o] Error 1
ERROR: compilation failed for package ‘vctrs’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/vctrs’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/vctrs’
Warning in install.packages :
installation of package ‘vctrs’ had non-zero exit status
ERROR: dependency ‘Rcpp’ is not available for package ‘fs’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/fs’
Warning in install.packages :
installation of package ‘fs’ had non-zero exit status
ERROR: dependency ‘Rcpp’ is not available for package ‘lubridate’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/lubridate’
Warning in install.packages :
installation of package ‘lubridate’ had non-zero exit status
ERROR: dependency ‘Rcpp’ is not available for package ‘xml2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
* installing *source* package ‘tidyselect’ ...
** package ‘tidyselect’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 0.4.1 is being loaded, but >= 0.4.3 is required
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading failed for package ‘tidyselect’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/tidyselect’
Warning in install.packages :
installation of package ‘tidyselect’ had non-zero exit status
ERROR: dependencies ‘knitr’, ‘base64enc’ are not available for package ‘rmarkdown’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmarkdown’
Warning in install.packages :
installation of package ‘rmarkdown’ had non-zero exit status
ERROR: dependency ‘isoband’ is not available for package ‘ggplot2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
* installing *source* package ‘hms’ ...
** package ‘hms’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘vctrs’ 0.2.0 is being loaded, but >= 0.2.1 is required
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading failed for package ‘hms’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/hms’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/hms’
Warning in install.packages :
installation of package ‘hms’ had non-zero exit status
ERROR: dependencies ‘Rcpp’, ‘tidyselect’ are not available for package ‘dplyr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/dplyr’
Warning in install.packages :
installation of package ‘dplyr’ had non-zero exit status
ERROR: dependencies ‘Rcpp’, ‘tidyselect’ are not available for package ‘haven’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/haven’
Warning in install.packages :
installation of package ‘haven’ had non-zero exit status
ERROR: dependencies ‘fs’, ‘rmarkdown’ are not available for package ‘reprex’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/reprex’
Warning in install.packages :
installation of package ‘reprex’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘tidyselect’ are not available for package ‘dbplyr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/dbplyr’
Warning in install.packages :
installation of package ‘dbplyr’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘Rcpp’, ‘tidyselect’ are not available for package ‘tidyr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/tidyr’
Warning in install.packages :
installation of package ‘tidyr’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘tidyr’ are not available for package ‘broom’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/broom’
Warning in install.packages :
installation of package ‘broom’ had non-zero exit status
ERROR: dependencies ‘broom’, ‘dplyr’, ‘tidyr’, ‘tidyselect’ are not available for package ‘modelr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/modelr’
Warning in install.packages :
installation of package ‘modelr’ had non-zero exit status
ERROR: dependencies ‘broom’, ‘dbplyr’, ‘dplyr’, ‘ggplot2’, ‘haven’, ‘lubridate’, ‘modelr’, ‘reprex’, ‘tidyr’, ‘xml2’ are not available for package ‘tidyverse’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/tidyverse’
Warning in install.packages :
installation of package ‘tidyverse’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/y7/cg5_y20s33s9cj5y74v3rzc00000gs/T/RtmpOLLsiu/downloaded_packages’

Related

Error when installing brms package in R - bayesplot cannot be installed

I am trying to install the R package brms on my Ubuntu 22.04 LTS computer. My R version is 4.2.2 and I am using RStudio RStudio 2022.07.2 "Spotted Wakerobin".
rstan is installed and I have successfully verified the installation. My stan version is 2.21.0.
When I try installing brms in RStudio this is the output:
> install.packages("brms")
Installing package into ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘bayesplot’, ‘shinystan’, ‘bridgesampling’, ‘nleqslv’
trying URL 'https://cloud.r-project.org/src/contrib/bayesplot_1.10.0.tar.gz'
Content type 'application/x-gzip' length 4993447 bytes (4.8 MB)
==================================================
downloaded 4.8 MB
trying URL 'https://cloud.r-project.org/src/contrib/shinystan_2.6.0.tar.gz'
Content type 'application/x-gzip' length 2399890 bytes (2.3 MB)
==================================================
downloaded 2.3 MB
trying URL 'https://cloud.r-project.org/src/contrib/bridgesampling_1.1-2.tar.gz'
Content type 'application/x-gzip' length 1679600 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
trying URL 'https://cloud.r-project.org/src/contrib/nleqslv_3.3.3.tar.gz'
Content type 'application/x-gzip' length 84686 bytes (82 KB)
==================================================
downloaded 82 KB
trying URL 'https://cloud.r-project.org/src/contrib/brms_2.18.0.tar.gz'
Content type 'application/x-gzip' length 4486548 bytes (4.3 MB)
==================================================
downloaded 4.3 MB
* installing *source* package ‘bayesplot’ ...
** package ‘bayesplot’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in element_line(linewidth = 0.3) :
unused argument (linewidth = 0.3)
Error: unable to load R code in package ‘bayesplot’
Execution halted
ERROR: lazy loading failed for package ‘bayesplot’
* removing ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/bayesplot’
Warning in install.packages :
installation of package ‘bayesplot’ had non-zero exit status
* installing *source* package ‘bridgesampling’ ...
** package ‘bridgesampling’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (bridgesampling)
* installing *source* package ‘nleqslv’ ...
** package ‘nleqslv’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include/" -I"/usr/lib/R/site-library/RcppEigen/include/" -I"/usr/lib/R/site-library/RcppEigen/include/unsupported" -I"/usr/lib/R/site-library/BH/include" -I"/usr/lib/R/site-library/StanHeaders/include/src/" -I"/usr/lib/R/site-library/StanHeaders/include/" -I"/usr/lib/R/site-library/RcppParallel/include/" -I"/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include '/usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp' -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1 -fpic -g -O2 -ffile-prefix-map=/build/r-base-Faorqz/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init.c -o init.o
In file included from /usr/lib/R/site-library/RcppEigen/include/Eigen/Core:88,
from /usr/lib/R/site-library/RcppEigen/include/Eigen/Dense:1,
from /usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
from <command-line>:
/usr/lib/R/site-library/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:1: error: unknown type name ‘namespace’
628 | namespace Eigen {
| ^~~~~~~~~
/usr/lib/R/site-library/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
628 | namespace Eigen {
| ^
In file included from /usr/lib/R/site-library/RcppEigen/include/Eigen/Dense:1,
from /usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
from <command-line>:
/usr/lib/R/site-library/RcppEigen/include/Eigen/Core:96:10: fatal error: complex: No such file or directory
96 | #include <complex>
| ^~~~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:169: init.o] Error 1
ERROR: compilation failed for package ‘nleqslv’
* removing ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/nleqslv’
Warning in install.packages :
installation of package ‘nleqslv’ had non-zero exit status
ERROR: dependency ‘bayesplot’ is not available for package ‘shinystan’
* removing ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/shinystan’
Warning in install.packages :
installation of package ‘shinystan’ had non-zero exit status
ERROR: dependencies ‘bayesplot’, ‘shinystan’, ‘nleqslv’ are not available for package ‘brms’
* removing ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/brms’
Warning in install.packages :
installation of package ‘brms’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpS56F1Q/downloaded_packages’
There seems to be a problem when installing bayesplot but I'm not sure how to solve it.
Does anyone have any suggestions?
Just in case someon encounters the same problem:
I installed devtools to be able to install bayesplot directly from github using:
install_github("stan-dev/bayesplot", dependencies = TRUE, build_vignettes = FALSE)
This only worked for me after installing all the packages that throw compilation errors in R directly and not in RStudio.
After bayesplot was installed, I was able to install brms.

Error installing ggplot2 in RStudio - MacOS

I'd like to express my thanks in advance for your help. I have been attempting to install the package "ggplot2" for two weeks now in RStudio, and cannot figure out my non-zero exit status errors. I have posted the resulting error code at the end of this message. I have successfully installed some packages, but have failed to install ggplot2 and plotly. I have an assignment due using these packages tonight and would greatly appreciate any insight you can give.
> install.packages("ggplot2", dependencies = TRUE)
also installing the dependencies ‘cli’, ‘rlang’, ‘lifecycle’, ‘scales’
There are binary versions available but the source versions are later:
binary source needs_compilation
cli 3.2.0 3.4.1 TRUE
rlang 1.0.2 1.0.6 TRUE
lifecycle 1.0.1 1.0.3 FALSE
scales 1.1.1 1.2.1 FALSE
ggplot2 3.3.5 3.3.6 FALSE
Do you want to install from sources the packages which need compilation? (Yes/no/cancel) Yes
installing the source packages ‘cli’, ‘rlang’, ‘lifecycle’, ‘scales’, ‘ggplot2’
trying URL 'http://archive.linux.duke.edu/cran/src/contrib/cli_3.4.1.tar.gz'
Content type 'application/octet-stream' length 540044 bytes (527 KB)
==================================================
downloaded 527 KB
trying URL 'http://archive.linux.duke.edu/cran/src/contrib/rlang_1.0.6.tar.gz'
Content type 'application/octet-stream' length 742508 bytes (725 KB)
==================================================
downloaded 725 KB
trying URL 'http://archive.linux.duke.edu/cran/src/contrib/lifecycle_1.0.3.tar.gz'
Content type 'application/octet-stream' length 106854 bytes (104 KB)
==================================================
downloaded 104 KB
trying URL 'http://archive.linux.duke.edu/cran/src/contrib/scales_1.2.1.tar.gz'
Content type 'application/octet-stream' length 270609 bytes (264 KB)
==================================================
downloaded 264 KB
trying URL 'http://archive.linux.duke.edu/cran/src/contrib/ggplot2_3.3.6.tar.gz'
Content type 'application/octet-stream' length 3061989 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘cli’ ...
** package ‘cli’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘cli’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cli’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cli’
Warning in install.packages :
installation of package ‘cli’ had non-zero exit status
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘rlang’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rlang’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rlang’
Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status
* installing *source* package ‘lifecycle’ ...
** package ‘lifecycle’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 1.0.2 is being loaded, but >= 1.0.6 is required
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading failed for package ‘lifecycle’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/lifecycle’
Warning in install.packages :
installation of package ‘lifecycle’ had non-zero exit status
ERROR: dependency ‘lifecycle’ is not available for package ‘scales’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/scales’
Warning in install.packages :
installation of package ‘scales’ had non-zero exit status
ERROR: dependency ‘scales’ is not available for package ‘ggplot2’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/sr/02bnxzdx0hvcp6c37xfhlf300000gn/T/Rtmpje9xhl/downloaded_packages’
> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’

Unable to install specific R packages

I am trying to install sf package in R, but it returns error and unable to install the package.
The warning message said
installation of package ‘sf’ had non-zero exit status.
Would you please advise me on how to install the package? I am using Windows with R version 3.6.1.
Platform: x86_64-w64-mingw32/x64 (64-bit)
Below is the all messages:
> install.packages("sf")
Installing package into ‘C:/Users/***/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘wk’, ‘s2’, ‘units’
There are binary versions available but the source versions are later:
binary source needs_compilation
wk 0.4.1 0.5.0 TRUE
s2 1.0.4 1.0.7 TRUE
units 0.7-1 0.7-2 TRUE
sf 0.9-8 1.0-4 TRUE
installing the source packages ‘wk’, ‘s2’, ‘units’, ‘sf’
trying URL 'https://cran.rstudio.com/src/contrib/wk_0.5.0.tar.gz'
Content type 'application/x-gzip' length 138686 bytes (135 KB)
downloaded 135 KB
trying URL 'https://cran.rstudio.com/src/contrib/s2_1.0.7.tar.gz'
Content type 'application/x-gzip' length 2235408 bytes (2.1 MB)
downloaded 2.1 MB
trying URL 'https://cran.rstudio.com/src/contrib/units_0.7-2.tar.gz'
Content type 'application/x-gzip' length 855840 bytes (835 KB)
downloaded 835 KB
trying URL 'https://cran.rstudio.com/src/contrib/sf_1.0-4.tar.gz'
Content type 'application/x-gzip' length 3526535 bytes (3.4 MB)
downloaded 3.4 MB
* installing *source* package 'wk' ...
** パッケージ 'wk' の解凍および MD5 サムの検証に成功しました
** using staged installation
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -I../inst/include/ -I"C:/Users/***/Documents/R/win-library/3.6/cpp11/include" -O3 -Wall -std=gnu99 -mtune=generic -c bbox-handler.c -o bbox-handler.o
sh: line 1: c:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-36~1.1/etc/i386/Makeconf:208: bbox-handler.o] Error 127
ERROR: compilation failed for package 'wk'
* removing 'C:/Users/***/Documents/R/win-library/3.6/wk'
Warning in install.packages :
installation of package ‘wk’ had non-zero exit status
* installing *source* package 'units' ...
** パッケージ 'units' の解凍および MD5 サムの検証に成功しました
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
*** arch - i386
rm -Rf units.dll RcppExports.o udunits.o
"C:/PROGRA~1/R/R-36~1.1/bin/i386/Rscript.exe" "../tools/winlibs.R"
mkdir -p ../inst
rm -Rf ../inst/share
cp -r ../windows/udunits-2.2.20/share ../inst/
c:/Rtools/mingw_32/bin/g++ -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -DUDUNITS2_DIR=0 -I../windows/udunits-2.2.20/include -I"C:/Program Files/R/R-3.6.1/library/Rcpp/include" -O2 -Wall -mtune=generic -c RcppExports.cpp -o RcppExports.o
sh: line 1: c:/Rtools/mingw_32/bin/g++: No such file or directory
make: *** [C:/PROGRA~1/R/R-36~1.1/etc/i386/Makeconf:215: RcppExports.o] Error 127
ERROR: compilation failed for package 'units'
* removing 'C:/Users/***/Documents/R/win-library/3.6/units'
Warning in install.packages :
installation of package ‘units’ had non-zero exit status
ERROR: dependency 'wk' is not available for package 's2'
* removing 'C:/Users/***/Documents/R/win-library/3.6/s2'
Warning in install.packages :
installation of package ‘s2’ had non-zero exit status
ERROR: dependencies 's2', 'units' are not available for package 'sf'
* removing 'C:/Users/***/Documents/R/win-library/3.6/sf'
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\***\AppData\Local\Temp\RtmpuiUgtA\downloaded_packages’
I specified the package's url as below, but it returns error as well;
> install.packages("https://cran.r-project.org/src/contrib/sf_1.0-4.tar.gz", repos=NULL)
Installing package into ‘C:/Users/***/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/src/contrib/sf_1.0-4.tar.gz'
Content type 'application/x-gzip' length 3526535 bytes (3.4 MB)
downloaded 3.4 MB
ERROR: dependencies 's2', 'units' are not available for package 'sf'
* removing 'C:/Users/***/Documents/R/win-library/3.6/sf'
Warning in install.packages :
installation of package ‘C:/Users/***/AppData/Local/Temp/RtmpuiUgtA/downloaded_packages/sf_1.0-4.tar.gz’ had non-zero exit status

Errors when trying to install R packages from source (tidyverse)

I was trying to install tidyverse in R. Some packages gave me error messages so I tried to google and resolve them. I found some solutions but ran into new errors and now I'm stuck and can't seem to make progress. The three main errors left are:
1.
WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of
Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
*** arch - i386 c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-35~1.3/include" -DNDEBUG -I./lib/ -O3 -Wall -std=gnu99 -mtune=generic -c capture.c -o capture.o sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory make: ***
[C:/PROGRA~1/R/R-35~1.3/etc/i386/Makeconf:208: capture.o] Error 127
ERROR: compilation failed for package 'rlang'
A few packages used old binary files so I tried installing RTools40 (https://cran.r-project.org/bin/windows/Rtools/) to force installation from source files. I followed the instructions on the website and everything seems to work until I run this code:
install.packages("tidyverse", type = "source")
This gives me the error message above (and more, I have posted the whole message from the console down below). "c:/Rtools/mingw_32/bin/gcc" that path and file definitely exists, I checked. It still says I haven't installed Rtools... What am I missing?
2.
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck =
vI[[i]]) : namespace 'dplyr' 0.8.5 is being loaded, but >= 1.0.0 is
required ERROR: lazy loading failed for package 'broom'
This happens with some packages and I assume it should be fixed if point 1 is fixed.
Full message from install tidyverse:
install.packages("tidyverse", type = "source") WARNING: Rtools is
required to build R packages but is not currently installed. Please
download and install the appropriate version of Rtools before
proceeding:
https://cran.rstudio.com/bin/windows/Rtools/ Installing package into
‘C:/Users/User/Documents/R/win-library/3.5’ (as ‘lib’ is unspecified)
also installing the dependencies ‘rlang’, ‘tidyselect’, ‘vctrs’,
‘dplyr’, ‘broom’, ‘dbplyr’, ‘modelr’
versuche URL
'https://cran.rstudio.com/src/contrib/rlang_0.4.10.tar.gz' Content
type 'application/x-gzip' length 915685 bytes (894 KB) downloaded 894
KB
versuche URL
'https://cran.rstudio.com/src/contrib/tidyselect_1.1.0.tar.gz' Content
type 'application/x-gzip' length 90842 bytes (88 KB) downloaded 88 KB
versuche URL 'https://cran.rstudio.com/src/contrib/vctrs_0.3.6.tar.gz'
Content type 'application/x-gzip' length 778016 bytes (759 KB)
downloaded 759 KB
versuche URL 'https://cran.rstudio.com/src/contrib/dplyr_1.0.2.tar.gz'
Content type 'application/x-gzip' length 935654 bytes (913 KB)
downloaded 913 KB
versuche URL 'https://cran.rstudio.com/src/contrib/broom_0.7.3.tar.gz'
Content type 'application/x-gzip' length 618499 bytes (604 KB)
downloaded 604 KB
versuche URL
'https://cran.rstudio.com/src/contrib/dbplyr_2.0.0.tar.gz' Content
type 'application/x-gzip' length 534910 bytes (522 KB) downloaded 522
KB
versuche URL
'https://cran.rstudio.com/src/contrib/modelr_0.1.8.tar.gz' Content
type 'application/x-gzip' length 121333 bytes (118 KB) downloaded 118
KB
versuche URL
'https://cran.rstudio.com/src/contrib/tidyverse_1.3.0.tar.gz' Content
type 'application/x-gzip' length 712837 bytes (696 KB) downloaded 696
KB
installing source package 'rlang' ...
** Paket 'rlang' erfolgreich entpackt und MD5 Summen überprüft
** libs
*** arch - i386 c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-35~1.3/include" -DNDEBUG -I./lib/ -O3 -Wall -std=gnu99 -mtune=generic -c capture.c -o capture.o sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory make: ***
[C:/PROGRA~1/R/R-35~1.3/etc/i386/Makeconf:208: capture.o] Error 127
ERROR: compilation failed for package 'rlang'
removing 'C:/Users/User/Documents/R/win-library/3.5/rlang'
restoring previous 'C:/Users/User/Documents/R/win-library/3.5/rlang' In R CMD INSTALL Warning in install.packages : installation of
package ‘rlang’ had non-zero exit status
installing source package 'vctrs' ...
** Paket 'vctrs' erfolgreich entpackt und MD5 Summen überprüft
** libs
*** arch - i386 c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-35~1.3/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c altrep-rle.c -o altrep-rle.o sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory make: ***
[C:/PROGRA~1/R/R-35~1.3/etc/i386/Makeconf:208: altrep-rle.o] Error 127
ERROR: compilation failed for package 'vctrs'
removing 'C:/Users/User/Documents/R/win-library/3.5/vctrs'
restoring previous 'C:/Users/User/Documents/R/win-library/3.5/vctrs' In R CMD INSTALL Warning in install.packages : installation of
package ‘vctrs’ had non-zero exit status
installing source package 'tidyselect' ...
** Paket 'tidyselect' erfolgreich entpackt und MD5 Summen überprüft
** R
** inst
** byte-compile and prepare package for lazy loading Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'rlang' 0.4.5 is being loaded, but >= 0.4.6 is required
ERROR: lazy loading failed for package 'tidyselect'
removing 'C:/Users/User/Documents/R/win-library/3.5/tidyselect'
restoring previous 'C:/Users/User/Documents/R/win-library/3.5/tidyselect' In R CMD
INSTALL Warning in install.packages : installation of package
‘tidyselect’ had non-zero exit status
installing source package 'dplyr' ...
** Paket 'dplyr' erfolgreich entpackt und MD5 Summen überprüft
** libs
*** arch - i386 c:/Rtools/mingw_32/bin/g++ -I"C:/PROGRA~1/R/R-35~1.3/include" -DNDEBUG -O2 -Wall -mtune=generic -c filter.cpp -o filter.o sh: c:/Rtools/mingw_32/bin/g++: No such file or directory make: ***
[C:/PROGRA~1/R/R-35~1.3/etc/i386/Makeconf:215: filter.o] Error 127
ERROR: compilation failed for package 'dplyr'
removing 'C:/Users/User/Documents/R/win-library/3.5/dplyr'
restoring previous 'C:/Users/User/Documents/R/win-library/3.5/dplyr' In R CMD INSTALL Warning in install.packages : installation of
package ‘dplyr’ had non-zero exit status
installing source package 'broom' ...
** Paket 'broom' erfolgreich entpackt und MD5 Summen überprüft
** R
** inst
** byte-compile and prepare package for lazy loading Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'dplyr' 0.8.5 is being loaded, but >= 1.0.0 is required
ERROR: lazy loading failed for package 'broom'
removing 'C:/Users/User/Documents/R/win-library/3.5/broom' In R CMD INSTALL Warning in install.packages : installation of package
‘broom’ had non-zero exit status
installing source package 'dbplyr' ...
** Paket 'dbplyr' erfolgreich entpackt und MD5 Summen überprüft
** R
** inst
** byte-compile and prepare package for lazy loading Error : object 'relocate' is not exported by 'namespace:dplyr' ERROR: lazy loading
failed for package 'dbplyr'
removing 'C:/Users/User/Documents/R/win-library/3.5/dbplyr' In R CMD INSTALL Warning in install.packages : installation of package
‘dbplyr’ had non-zero exit status ERROR: dependency 'broom' is not
available for package 'modelr'
removing 'C:/Users/User/Documents/R/win-library/3.5/modelr' In R CMD INSTALL Warning in install.packages : installation of package
‘modelr’ had non-zero exit status ERROR: dependencies 'broom',
'dbplyr', 'modelr' are not available for package 'tidyverse'
removing 'C:/Users/User/Documents/R/win-library/3.5/tidyverse' In R CMD INSTALL Warning in install.packages : installation of package
‘tidyverse’ had non-zero exit status

Error installing leaflet package for R in ubuntu

I can't install the leaflet packages for R in ubuntu. I've correctly install R and I was able to install some other packages like "RCurl" but I cannot install leaflet... Here are the output I get :
install.packages("leaflet",dep=T)
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning: dependency ‘plyr’ is not available
also installing the dependencies ‘scales’, ‘rgdal’
trying URL 'http://cran.univ-lyon1.fr/src/contrib/scales_0.3.0.tar.gz'
Content type 'application/x-gzip' length 57030 bytes (55 Kb)
opened URL
==================================================
downloaded 55 Kb
trying URL 'http://cran.univ-lyon1.fr/src/contrib/rgdal_1.1-3.tar.gz'
Content type 'application/x-gzip' length 1647483 bytes (1.6 Mb)
opened URL
==================================================
downloaded 1.6 Mb
trying URL 'http://cran.univ-lyon1.fr/src/contrib/leaflet_1.0.0.tar.gz'
Content type 'application/x-gzip' length 401681 bytes (392 Kb)
opened URL
==================================================
downloaded 392 Kb
ERROR: dependency ‘plyr’ is not available for package ‘scales’
* removing ‘/usr/local/lib/R/site-library/scales’
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 1.1-3
checking for /usr/bin/svnversion... no
configure: svn revision: 594
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/usr/local/lib/R/site-library/rgdal’
ERROR: dependency ‘scales’ is not available for package ‘leaflet’
* removing ‘/usr/local/lib/R/site-library/leaflet’
The downloaded source packages are in
‘/tmp/Rtmp9C0NCQ/downloaded_packages’
Warning messages:
1: In install.packages("leaflet", dep = T) :
installation of package ‘scales’ had non-zero exit status
2: In install.packages("leaflet", dep = T) :
installation of package ‘rgdal’ had non-zero exit status
3: In install.packages("leaflet", dep = T) :
installation of package ‘leaflet’ had non-zero exit status
It looks like this is a dependencies problem but I did try to install it with install.packages("leaflet",dep=T). Do you have a idea ?

Resources