Problem Importing Libraries

Hi everyone,

I am trying to install the following packages on my MacBook and I have been getting errors.

install.packages("dplyr")
install.packages("Quandl")
install.packages("data.table")
install.packages("ggplot2")
install.packages("readxl")
install.packages("tidyverse")

library(data.table)
library(tidyverse)
library(readxl)
#library(dsr)

I have also tried using the following code:

install.packages("dplyr", dependencies = T)

or

install.packages("devtools")
library(devtools)
install_github("quandl/quandl-r")
library(Quandl)

A sample error I have been getting is:

* installing *source* package ‘zoo’ ...
** package ‘zoo’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -I"/anaconda3/lib/R/include" -DNDEBUG -I../inst/include  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/anaconda3/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/anaconda3/include -fdebug-prefix-map==/usr/local/src/conda/- -fdebug-prefix-map==/usr/local/src/conda-prefix  -c coredata.c -o coredata.o
In file included from coredata.c:23:
/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: *** [/anaconda3/lib/R/etc/Makeconf:160: coredata.o] Error 1
ERROR: compilation failed for package ‘zoo’
* removing ‘/anaconda3/lib/R/library/zoo’

Thank you!

I'm also on Mac (2011 Airbook) and I have Anaconda, which I use for Python and really like. But, I fear, you're asking for trouble to rely on it as an R package manager for source compilation.

My suggestion is to go into your .bash_profile and demote Anaconda in your $PATH precedence to make sure that vanilla XCode will get the first crack at compilation. Not that this will necessarily solve all your problems, but it will eliminate figuring out how to find the right version of stdlib.h and the right place to put it in order to make Anaconda successful.

Another suggestion. Unless you are really jammed for RAM memory use

install.packages("tidyverse")
library(tidyverse)

to bring in all the wonderful facilities that you will often use.

I just ran your install and none of them required compilation, so you're losing the advantage of the volunteers who have sweated out the OSx compilation details.

FWIW: I seldom have source installation problems under Ubuntu 10.18.

1 Like

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