0

I just start learning R and yesterday I tried to install some basic packages (tidyverse, ggplot2, dplyr, broom, ggpubr) in trying to run a linear regression model.

At the first attempted it worked and I could installed and called all the library from the packages. However, after a while R was crashed and forced to reopen. I called the library and it said that there is no library. So I reinstalled the packages and it turned out that I could not install.

I am using MacOS BigSur version 11.3

This is what appeared on my console:

    > install.packages("ggplot2") also installing the dependencies ‘lattice’, ‘colorspace’, ‘nlme’, ‘Matrix’, ‘farver’, ‘lifecycle’, ‘munsell’, ‘ellipsis’, ‘pillar’, ‘rlang’, ‘vctrs’, ‘isoband’, ‘MASS’, ‘mgcv’, ‘scales’, ‘tibble’

trying URL 'https://cran.rstudio.com/src/contrib/lattice_0.20-44.tar.gz' Content type 'application/x-gzip' length 399257 bytes (389 KB)
================================================== downloaded 389 KB

trying URL 'https://cran.rstudio.com/src/contrib/colorspace_2.0-1.tar.gz' Content type 'application/x-gzip' length 2193384 bytes (2.1 MB)
================================================== downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-152.tar.gz' Content type 'application/x-gzip' length 805569 bytes (786 KB)
================================================== downloaded 786 KB

trying URL 'https://cran.rstudio.com/src/contrib/Matrix_1.3-3.tar.gz' Content type 'application/x-gzip' length 2049932 bytes (2.0 MB)
================================================== downloaded 2.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/farver_2.1.0.tar.gz' Content type 'application/x-gzip' length 1281864 bytes (1.2 MB)
================================================== downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.0.tar.gz' Content type 'application/x-gzip' length 83389 bytes (81 KB)
================================================== downloaded 81 KB

trying URL 'https://cran.rstudio.com/src/contrib/munsell_0.5.0.tar.gz' Content type 'application/x-gzip' length 182653 bytes (178 KB)
================================================== downloaded 178 KB

trying URL 'https://cran.rstudio.com/src/contrib/ellipsis_0.3.2.tar.gz' Content type 'application/x-gzip' length 8066 bytes
================================================== downloaded 8066 bytes

trying URL 'https://cran.rstudio.com/src/contrib/pillar_1.6.0.tar.gz' Content type 'application/x-gzip' length 1100197 bytes (1.0 MB)
================================================== downloaded 1.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.4.11.tar.gz' Content type 'application/x-gzip' length 861727 bytes (841 KB)
================================================== downloaded 841 KB

trying URL 'https://cran.rstudio.com/src/contrib/vctrs_0.3.8.tar.gz' Content type 'application/x-gzip' length 782608 bytes (764 KB)
================================================== downloaded 764 KB

trying URL 'https://cran.rstudio.com/src/contrib/isoband_0.2.4.tar.gz' Content type 'application/x-gzip' length 2010708 bytes (1.9 MB)
================================================== downloaded 1.9 MB

trying URL 'https://cran.rstudio.com/src/contrib/MASS_7.3-54.tar.gz' Content type 'application/x-gzip' length 506246 bytes (494 KB)
================================================== downloaded 494 KB

trying URL 'https://cran.rstudio.com/src/contrib/mgcv_1.8-35.tar.gz' Content type 'application/x-gzip' length 1202446 bytes (1.1 MB)
================================================== downloaded 1.1 MB

trying URL 'https://cran.rstudio.com/src/contrib/scales_1.1.1.tar.gz' Content type 'application/x-gzip' length 515201 bytes (503 KB)
================================================== downloaded 503 KB

trying URL 'https://cran.rstudio.com/src/contrib/tibble_3.1.1.tar.gz' Content type 'application/x-gzip' length 686855 bytes (670 KB)
================================================== downloaded 670 KB

trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.3.3.tar.gz' Content type 'application/x-gzip' length 3058840 bytes (2.9 MB)
================================================== downloaded 2.9 MB

* installing *source* package ‘lattice’ ...
** package ‘lattice’ successfully unpacked and MD5 sums checked
** using staged installation
** libs x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1
-fdebug-prefix-map=/opt/anaconda3=/usr/local/src/conda-prefix  -c init.c -o init.o In file included from init.c:2: /opt/anaconda3/lib/R/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: *** [/opt/anaconda3/lib/R/etc/Makeconf:168: init.o] Error 1 ERROR: compilation failed for package ‘lattice’
* removing ‘/opt/anaconda3/lib/R/library/lattice’ Warning in install.packages :   installation of package ‘lattice’ had non-zero exit status
* installing *source* package ‘colorspace’ ...
** package ‘colorspace’ successfully unpacked and MD5 sums checked
** using staged installation
** libs x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1
-fdebug-prefix-map=/opt/anaconda3=/usr/local/src/conda-prefix  -c colorspace.c -o colorspace.o colorspace.c:2:10: fatal error: 'ctype.h' file not found
#include <ctype.h>
         ^~~~~~~~~ 1 error generated. make: *** [/opt/anaconda3/lib/R/etc/Makeconf:168: colorspace.o] Error 1 ERROR: compilation failed for package ‘colorspace’
* removing ‘/opt/anaconda3/lib/R/library/colorspace’ Warning in install.packages :   installation of package ‘colorspace’ had non-zero exit status
* installing *source* package ‘farver’ ...
** package ‘farver’ successfully unpacked and MD5 sums checked
** using staged installation
** libs x86_64-apple-darwin13.4.0-clang++ -std=gnu++11 -I"/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden  -fmessage-length=0 -I/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1
-fdebug-prefix-map=/opt/anaconda3=/usr/local/src/conda-prefix  -c ColorSpace.cpp -o ColorSpace.o In file included from ColorSpace.cpp:1: In file included from ./ColorSpace.h:4: In file included from /opt/anaconda3/bin/../include/c++/v1/typeinfo:61: In file included from /opt/anaconda3/bin/../include/c++/v1/exception:82: In file included from /opt/anaconda3/bin/../include/c++/v1/cstdlib:86: /opt/anaconda3/bin/../include/c++/v1/stdlib.h:94:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
              ^~~~~~~~~~ 1 error generated. make: *** [/opt/anaconda3/lib/R/etc/Makeconf:175: ColorSpace.o] Error 1 ERROR: compilation failed for package ‘farver’
* removing ‘/opt/anaconda3/lib/R/library/farver’ Warning in install.packages :   installation of package ‘farver’ had non-zero exit status
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1
-fdebug-prefix-map=/opt/anaconda3=/usr/local/src/conda-prefix  -c capture.c -o capture.o In file included from capture.c:1: /opt/anaconda3/lib/R/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
          ^~~~~~~~~ 1 error generated. make: *** [/opt/anaconda3/lib/R/etc/Makeconf:168: capture.o] Error 1 ERROR: compilation failed for package ‘rlang’
* removing ‘/opt/anaconda3/lib/R/library/rlang’
* restoring previous ‘/opt/anaconda3/lib/R/library/rlang’ Warning in install.packages :   installation of package ‘rlang’ had non-zero exit status
* installing *source* package ‘isoband’ ...
** package ‘isoband’ successfully unpacked and MD5 sums checked
** using staged installation
** libs x86_64-apple-darwin13.4.0-clang++ -std=gnu++11 -I"/opt/anaconda3/lib/R/include" -DNDEBUG -Itestthat  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden  -fmessage-length=0 -I/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1
-fdebug-prefix-map=/opt/anaconda3=/usr/local/src/conda-prefix  -c clip-lines.cpp -o clip-lines.o In file included from clip-lines.cpp:3: In file included from /opt/anaconda3/lib/R/include/R.h:47: In file included from /opt/anaconda3/bin/../include/c++/v1/cstdlib:86: /opt/anaconda3/bin/../include/c++/v1/stdlib.h:94:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
              ^~~~~~~~~~ 1 error generated. make: *** [/opt/anaconda3/lib/R/etc/Makeconf:175: clip-lines.o] Error 1 ERROR: compilation failed for package ‘isoband’
* removing ‘/opt/anaconda3/lib/R/library/isoband’ Warning in install.packages :   installation of package ‘isoband’ had non-zero exit status
* installing *source* package ‘MASS’ ...
** package ‘MASS’ successfully unpacked and MD5 sums checked
** using staged installation
** libs x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1
-fdebug-prefix-map=/opt/anaconda3=/usr/local/src/conda-prefix  -c MASS.c -o MASS.o MASS.c:18:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
         ^~~~~~~~~~ 1 error generated. make: *** [/opt/anaconda3/lib/R/etc/Makeconf:168: MASS.o] Error 1 ERROR: compilation failed for package ‘MASS’
* removing ‘/opt/anaconda3/lib/R/library/MASS’ Warning in install.packages :   installation of package ‘MASS’ had non-zero exit status ERROR: dependency ‘lattice’ is not available for package ‘nlme’
* removing ‘/opt/anaconda3/lib/R/library/nlme’ Warning in install.packages :   installation of package ‘nlme’ had non-zero exit status ERROR: dependency ‘lattice’ is not available for package ‘Matrix’
* removing ‘/opt/anaconda3/lib/R/library/Matrix’ Warning in install.packages :   installation of package ‘Matrix’ 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’ 0.3.4 is being loaded, but >= 0.4.10 is required Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace Execution halted ERROR: lazy loading failed for package ‘lifecycle’
* removing ‘/opt/anaconda3/lib/R/library/lifecycle’ Warning in install.packages :   installation of package ‘lifecycle’ had non-zero exit status ERROR: dependency ‘colorspace’ is not available for package ‘munsell’
* removing ‘/opt/anaconda3/lib/R/library/munsell’ Warning in install.packages :   installation of package ‘munsell’ had non-zero exit status
* installing *source* package ‘ellipsis’ ...
** package ‘ellipsis’ successfully unpacked and MD5 sums checked
** using staged installation
** libs x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1
-fdebug-prefix-map=/opt/anaconda3=/usr/local/src/conda-prefix  -c dots.c -o dots.o In file included from dots.c:2: /opt/anaconda3/lib/R/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: *** [/opt/anaconda3/lib/R/etc/Makeconf:168: dots.o] Error 1 ERROR: compilation failed for package ‘ellipsis’
* removing ‘/opt/anaconda3/lib/R/library/ellipsis’
* restoring previous ‘/opt/anaconda3/lib/R/library/ellipsis’ Warning in install.packages :   installation of package ‘ellipsis’ had non-zero exit status
* installing *source* package ‘vctrs’ ...
** package ‘vctrs’ successfully unpacked and MD5 sums checked
** using staged installation
** libs x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1
-fdebug-prefix-map=/opt/anaconda3=/usr/local/src/conda-prefix  -c altrep-rle.c -o altrep-rle.o In file included from altrep-rle.c:1: In file included from ./vctrs.h:6: /opt/anaconda3/lib/R/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: *** [/opt/anaconda3/lib/R/etc/Makeconf:168: altrep-rle.o] Error 1 ERROR: compilation failed for package ‘vctrs’
* removing ‘/opt/anaconda3/lib/R/library/vctrs’ Warning in install.packages :   installation of package ‘vctrs’ had non-zero exit status ERROR: dependencies ‘nlme’, ‘Matrix’ are not available for package ‘mgcv’
* removing ‘/opt/anaconda3/lib/R/library/mgcv’ Warning in install.packages :   installation of package ‘mgcv’ had non-zero exit status ERROR: dependencies ‘farver’, ‘lifecycle’, ‘munsell’ are not available for package ‘scales’
* removing ‘/opt/anaconda3/lib/R/library/scales’ Warning in install.packages :   installation of package ‘scales’ had non-zero exit status ERROR: dependencies ‘lifecycle’, ‘vctrs’ are not available for package ‘pillar’
* removing ‘/opt/anaconda3/lib/R/library/pillar’ Warning in install.packages :   installation of package ‘pillar’ had non-zero exit status ERROR: dependencies ‘lifecycle’, ‘pillar’, ‘vctrs’ are not available for package ‘tibble’
* removing ‘/opt/anaconda3/lib/R/library/tibble’ Warning in install.packages :   installation of package ‘tibble’ had non-zero exit status ERROR: dependencies ‘isoband’, ‘MASS’, ‘mgcv’, ‘scales’, ‘tibble’ are not available for package ‘ggplot2’
* removing ‘/opt/anaconda3/lib/R/library/ggplot2’ Warning in install.packages :   installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in   ‘/private/var/folders/8v/b8bfgdqj169765m_rq191xj80000gn/T/RtmprnOeli/downloaded_packages’ Updating HTML index of packages in '.Library' Making 'packages.html' ... done
user2554330
  • 37,248
  • 4
  • 43
  • 90
Rida.rida
  • 1
  • 1
  • 2
    It looks as though you installed R using Conda. Try the CRAN build of R instead. – user2554330 May 10 '21 at 00:46
  • 1
    Possible duplicate: https://stackoverflow.com/questions/52954091/install-package-in-r-stdlib-h-file-not-found. Since you've used conda (which is not how most people use R), try `conda install -c r r-ggplot2` at the command line. – MrFlick May 10 '21 at 00:47
  • 1
    Trying to compile R packages from source on macOS Big Sur isn't easy (e.g. https://stackoverflow.com/a/65334247/12957340); it's probably best to listen to @MrFlick's advice if you are a beginner – jared_mamrot May 10 '21 at 02:32
  • Thank you sooo much to you all! I'm a total beginner and install R from the AnaConda package that I previously installed for my Python. I'll check all your suggestions! Appreciate a lot. @user2554330 – Rida.rida May 10 '21 at 04:23
  • Thanks! I'll try it and see how it goes @MrFlick – Rida.rida May 10 '21 at 04:25
  • Appreciate your suggestions! Thanks a ton! @jared_mamrot – Rida.rida May 10 '21 at 04:26
  • Do you have RTools installed? – mhovd May 10 '21 at 15:13

0 Answers0