Can't load packages in R or R Studio

Error Information:

Description of issue -
I am R Studio on my desktop and am unable to install the "tidyverse" package.
Every time I install, it says that that there are 18 warnings, for each sub package there is a non zero exit status.
It also keeps giving me this: ‘/private/var/folders/d1/36t110qd04gdl5qt5r5t0ydr0000gn/T/Rtmpc5VNbC/downloaded_packages’ - but I don't know what this means.
And when I use library to load the package, it says that the package is not there.

Steps taken so far -
I have updated my R Studio, and R as well where I have also tried installing it, but I get the same error issues.

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: 1.1.463
  • OS Version: 10.10.5
  • R Version: 3.3.3

From Troubleshooting Guide: Using RStudio

Hi @Anisha! Welcome!

R’s package installation messages can be cryptic! Here’s what this one means: R downloads files to a temporary location as part of the package installation process, so at the end (whether successful or not) it often notifies you of where it put the downloaded files. It’s not really important and doesn’t have anything to do with whether installation succeeded or not.

To figure out what’s going wrong with your tidyverse install, we’ll need some more information. Here are the two things that are most helpful to provide when asking questions about package installation problems:

  1. All the console output you see when you try to install the package
  2. The output of running sessionInfo()

Here is how you should provide that information:

  1. In a new post on a blank line, click the little </> button at the top of the posting box. This will insert a small template with the words “type or paste code here” selected.
  2. Copy the output from the console (no screenshots please!)
  3. Paste the output here, replacing the “type or paste code here” line in the template,

Following these steps makes it easier for helpers to read what you post and keeps the forum software from garbling it.

1 Like

Please see all output below including the session info.
Thank you!

> install.packages("tidyverse")
also installing the dependencies ‘ps’, ‘processx’, ‘fansi’, ‘glue’, ‘rlang’, ‘callr’, ‘fs’, ‘stringi’, ‘pillar’, ‘tidyselect’, ‘broom’, ‘dbplyr’, ‘modelr’, ‘reprex’, ‘stringr’, ‘tibble’, ‘tidyr’


  There are binary versions available but the source versions are later:
            binary  source needs_compilation
processx   2.0.0.1   3.2.0              TRUE
glue         1.2.0   1.3.0              TRUE
rlang        0.1.6 0.3.0.1              TRUE
callr        1.0.0   3.0.0             FALSE
stringi      1.1.6   1.2.4             FALSE
pillar       1.0.1   1.3.0             FALSE
tidyselect   0.2.3   0.2.5              TRUE
broom        0.4.3   0.5.0             FALSE
dbplyr       1.1.0   1.2.2             FALSE
modelr       0.1.1   0.1.2             FALSE
stringr      1.2.0   1.3.1             FALSE
tibble       1.3.4   1.4.2              TRUE
tidyr        0.7.2   0.8.2              TRUE
tidyverse    1.1.1   1.2.1             FALSE

Do you want to install from sources the packages which need compilation?
y/n: y
Packages which are only available in source form, and may need compilation of
  C/C++/Fortran: ‘ps’ ‘fansi’ ‘fs’
Do you want to attempt to install these from sources?
y/n: y
installing the source packages ‘ps’, ‘processx’, ‘fansi’, ‘glue’, ‘rlang’, ‘callr’, ‘fs’, ‘stringi’, ‘pillar’, ‘tidyselect’, ‘broom’, ‘dbplyr’, ‘modelr’, ‘reprex’, ‘stringr’, ‘tibble’, ‘tidyr’, ‘tidyverse’

trying URL 'https://cran.rstudio.com/src/contrib/ps_1.2.1.tar.gz'
Content type 'application/x-gzip' length 259477 bytes (253 KB)
==================================================
downloaded 253 KB

trying URL 'https://cran.rstudio.com/src/contrib/processx_3.2.0.tar.gz'
Content type 'application/x-gzip' length 97959 bytes (95 KB)
==================================================
downloaded 95 KB

trying URL 'https://cran.rstudio.com/src/contrib/fansi_0.4.0.tar.gz'
Content type 'application/x-gzip' length 266123 bytes (259 KB)
==================================================
downloaded 259 KB

trying URL 'https://cran.rstudio.com/src/contrib/glue_1.3.0.tar.gz'
Content type 'application/x-gzip' length 56368 bytes (55 KB)
==================================================
downloaded 55 KB

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

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

trying URL 'https://cran.rstudio.com/src/contrib/fs_1.2.6.tar.gz'
Content type 'application/x-gzip' length 799325 bytes (780 KB)
==================================================
downloaded 780 KB

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

trying URL 'https://cran.rstudio.com/src/contrib/pillar_1.3.0.tar.gz'
Content type 'application/x-gzip' length 103104 bytes (100 KB)
==================================================
downloaded 100 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyselect_0.2.5.tar.gz'
Content type 'application/x-gzip' length 21883 bytes (21 KB)
==================================================
downloaded 21 KB

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

trying URL 'https://cran.rstudio.com/src/contrib/dbplyr_1.2.2.tar.gz'
Content type 'application/x-gzip' length 263687 bytes (257 KB)
==================================================
downloaded 257 KB

trying URL 'https://cran.rstudio.com/src/contrib/modelr_0.1.2.tar.gz'
Content type 'application/x-gzip' length 118432 bytes (115 KB)
==================================================
downloaded 115 KB

trying URL 'https://cran.rstudio.com/src/contrib/reprex_0.2.1.tar.gz'
Content type 'application/x-gzip' length 1029128 bytes (1005 KB)
==================================================
downloaded 1005 KB

trying URL 'https://cran.rstudio.com/src/contrib/stringr_1.3.1.tar.gz'
Content type 'application/x-gzip' length 119156 bytes (116 KB)
==================================================
downloaded 116 KB

trying URL 'https://cran.rstudio.com/src/contrib/tibble_1.4.2.tar.gz'
Content type 'application/x-gzip' length 109808 bytes (107 KB)
==================================================
downloaded 107 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyr_0.8.2.tar.gz'
Content type 'application/x-gzip' length 378735 bytes (369 KB)
==================================================
downloaded 369 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyverse_1.2.1.tar.gz'
Content type 'application/x-gzip' length 61647 bytes (60 KB)
==================================================
downloaded 60 KB

* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** libs
clang -Wall -mtune=core2 -g -O2  -Wall px.c -o px
In file included from px.c:11:
In file included from /usr/include/stdlib.h:65:
/usr/include/sys/wait.h:109:10: fatal error: 'sys/signal.h' file not found
#include <sys/signal.h>         /* [XSI] for siginfo_t */
         ^
1 error generated.
make: *** [px] Error 1
ERROR: compilation failed for package ‘ps’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ps’
Warning in install.packages :
  installation of package ‘ps’ had non-zero exit status
* installing *source* package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c assumptions.c -o assumptions.o
In file included from assumptions.c:21:
In file included from /Library/Frameworks/R.framework/Resources/include/Rinternals.h:46:
In file included from /Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.0.2/include/limits.h:37:
In file included from /usr/include/limits.h:64:
/usr/include/machine/limits.h:6:10: fatal error: 'i386/limits.h' file not found
#include <i386/limits.h>
         ^
1 error generated.
make: *** [assumptions.o] Error 1
ERROR: compilation failed for package ‘fansi’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/fansi’
Warning in install.packages :
  installation of package ‘fansi’ had non-zero exit status
* installing *source* package ‘glue’ ...
** package ‘glue’ successfully unpacked and MD5 sums checked
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c glue.c -o glue.o
In file included from glue.c:1:
In file included from /Library/Frameworks/R.framework/Resources/include/Rinternals.h:46:
In file included from /Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.0.2/include/limits.h:37:
In file included from /usr/include/limits.h:64:
/usr/include/machine/limits.h:6:10: fatal error: 'i386/limits.h' file not found
#include <i386/limits.h>
         ^
1 error generated.
make: *** [glue.o] Error 1
ERROR: compilation failed for package ‘glue’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/glue’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/glue’
Warning in install.packages :
  installation of package ‘glue’ had non-zero exit status
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./lib/ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c capture.c -o capture.o
In file included from capture.c:1:
In file included from /Library/Frameworks/R.framework/Resources/include/Rinternals.h:46:
In file included from /Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.0.2/include/limits.h:37:
In file included from /usr/include/limits.h:64:
/usr/include/machine/limits.h:6:10: fatal error: 'i386/limits.h' file not found
#include <i386/limits.h>
         ^
1 error generated.
make: *** [capture.o] Error 1
ERROR: compilation failed for package ‘rlang’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rlang’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rlang’
Warning in install.packages :
  installation of package ‘rlang’ had non-zero exit status
* installing *source* package ‘fs’ ...
** package ‘fs’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./libuv/include -I. -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c dir.cc -o dir.o
In file included from dir.cc:2:
In file included from ./libuv/include/uv.h:62:
In file included from ./libuv/include/uv-unix.h:43:
/usr/include/signal.h:63:10: fatal error: 'sys/signal.h' file not found
#include <sys/signal.h>
         ^
1 error generated.
make: *** [dir.o] Error 1
ERROR: compilation failed for package ‘fs’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/fs’
Warning in install.packages :
  installation of package ‘fs’ had non-zero exit status
* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for R_HOME... /Library/Frameworks/R.framework/Resources
checking for R... /Library/Frameworks/R.framework/Resources/bin/R
checking for endianness... little
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... yes
checking for cat... /bin/cat
checking for local ICUDT_DIR... icu61/data
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang++ -E
configure: error: in `/private/var/folders/d1/36t110qd04gdl5qt5r5t0ydr0000gn/T/RtmpXFtZ5m/R.INSTALL12be256ba4e8/stringi':
configure: error: C preprocessor "clang++ -E" fails sanity check
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/stringi’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/stringi’
Warning in install.packages :
  installation of package ‘stringi’ had non-zero exit status
ERROR: dependency ‘ps’ is not available for package ‘processx’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/processx’
Warning in install.packages :
  installation of package ‘processx’ had non-zero exit status
ERROR: dependency ‘fansi’ is not available for package ‘pillar’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/pillar’
Warning in install.packages :
  installation of package ‘pillar’ had non-zero exit status
* installing *source* package ‘tidyselect’ ...
** package ‘tidyselect’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/RcppCommon.h:29:
In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp/r/headers.h:52:
In file included from /Library/Frameworks/R.framework/Resources/include/R.h:44:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstdlib:86:
In file included from /usr/include/stdlib.h:65:
/usr/include/sys/wait.h:109:10: fatal error: 'sys/signal.h' file not found
#include <sys/signal.h>         /* [XSI] for siginfo_t */
         ^
1 error generated.
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘tidyselect’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/tidyselect’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/tidyselect’
Warning in install.packages :
  installation of package ‘tidyselect’ had non-zero exit status
* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  namespace ‘stringi’ 1.1.2 is being loaded, but >= 1.1.7 is required
ERROR: lazy loading failed for package ‘stringr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/stringr’
Warning in install.packages :
  installation of package ‘stringr’ had non-zero exit status
ERROR: dependency ‘processx’ is not available for package ‘callr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/callr’
Warning in install.packages :
  installation of package ‘callr’ had non-zero exit status
ERROR: dependency ‘pillar’ is not available for package ‘tibble’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/tibble’
Warning in install.packages :
  installation of package ‘tibble’ had non-zero exit status
ERROR: dependency ‘tibble’ is not available for package ‘dbplyr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/dbplyr’
Warning in install.packages :
  installation of package ‘dbplyr’ had non-zero exit status
ERROR: dependencies ‘callr’, ‘fs’ are not available for package ‘reprex’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/reprex’
Warning in install.packages :
  installation of package ‘reprex’ had non-zero exit status
ERROR: dependency ‘tibble’ is not available for package ‘tidyr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/tidyr’
Warning in install.packages :
  installation of package ‘tidyr’ had non-zero exit status
ERROR: dependencies ‘stringr’, ‘tibble’, ‘tidyr’ are not available for package ‘broom’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/broom’
Warning in install.packages :
  installation of package ‘broom’ had non-zero exit status
ERROR: dependencies ‘broom’, ‘tibble’, ‘tidyr’ are not available for package ‘modelr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/modelr’
Warning in install.packages :
  installation of package ‘modelr’ had non-zero exit status
ERROR: dependencies ‘broom’, ‘dbplyr’, ‘modelr’, ‘reprex’, ‘stringr’, ‘tibble’, ‘tidyr’ are not available for package ‘tidyverse’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/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/d1/36t110qd04gdl5qt5r5t0ydr0000gn/T/Rtmp5cFNGj/downloaded_packages’
> library(tidyverse)
Error in library(tidyverse) : there is no package called ‘tidyverse’
> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.3.3 yaml_2.1.14

This is most likely an issue you are facing. Current R version is 3.5.1, so you probably need to update R when you have a chance. My hunch is that it'll resolve this particular issue.

Unfortunately, I don’t think the solution is as simple as updating R, though I agree that would make life substantially easier since all these packages would then be available as pre-compiled binaries. However:

Current R binaries are only available for OS X/macOS 10.11 and higher. So in this case, updating to current R means either updating to a new operating system version first, or attempting to compile R from source. Since the package installation problem seems to be caused by missing external compiler tools, I suspect building R from source would also not go well!

@Anisha:

This is a tough situation. Pre-compiled binaries of R packages are only built for the current and current-minus-1 versions of R. A new version of R is released every year (around April). The longer you run old R, the more packages you will have to compile yourself, leading to ever more time doing system administration to solve esoteric problems with compilers.

If there’s any way you can update your operating system to a version new enough to support current R binaries, I would strongly recommend doing so — followed by installing current R. At that point, you’ll be able to install the tidyverse packages with little to no trouble.

If you can’t upgrade your operating system and are therefore stuck on R 3.3, the thing you need to try to fix is your system’s compiler tools. There is something wrong with your C/C++ compilers that is preventing all these packages (which have C/C++ code that needs compiling) from building properly. On Mac, people usually install the “Xcode command line tools” to get these compiler tools installed. Do you remember if you ever did that?

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.