Mac cannot install any package requires compelition ('stdio.h' file not found)

install.packages causes 'stdio.h' file not found.
Tried to install xcode-select --install (already installed, tried to remove and reinstall)
Tried to download the 16gb of Xcode (didn't help)
Tried to download the "Command Line Tools for Xcode" from mac website

Searched in Google for solutions, could not find something that work. Hits:


StackOverflow: stdio-h-not-found-during-r-package-installation
(I cannot find macOS_SDK_headers_for_macOS_10.14.pkg see https://donatstudios.com/MojaveMissingHeaderFiles)

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)
MacOS 10.15.10

> install.packages("tableone")``` 


> Selection:
> Enter an item from the menu, or 0 to exit
> Selection: 1
> also installing the dependency ‘e1071’
> 
> trying URL 'https://cloud.r-project.org/src/contrib/e1071_1.7-3.tar.gz'
> Content type 'application/x-gzip' length 582517 bytes (568 KB)
> ==================================================
> downloaded 568 KB
> 
> trying URL 'https://cloud.r-project.org/src/contrib/tableone_0.11.1.tar.gz'
> Content type 'application/x-gzip' length 125451 bytes (122 KB)
> ==================================================
> downloaded 122 KB
> 
> * installing *source* package ‘e1071’ ...
> ** package ‘e1071’ successfully unpacked and MD5 sums checked
> ** using staged installation
> checking for C++ compiler default output file name... a.out
> checking whether the C++ compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C++ compiler... yes
> checking whether x86_64-apple-darwin13.4.0-clang++ -std=gnu++11 accepts -g... yes
> ** libs
> x86_64-apple-darwin13.4.0-clang -I"/Users/hanan/opt/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/hanan/opt/anaconda3/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/hanan/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=/Users/hanan/opt/anaconda3=/usr/local/src/conda-prefix  -c Rsvm.c -o Rsvm.o
> Rsvm.c:2:10: fatal error: 'stdio.h' file not found
> #include <stdio.h>
>          ^~~~~~~~~
> 1 error generated.
> make: *** [/Users/hanan/opt/anaconda3/lib/R/etc/Makeconf:168: Rsvm.o] Error 1
> ERROR: compilation failed for package ‘e1071’
> * removing ‘/Users/hanan/opt/anaconda3/lib/R/library/e1071’
> ERROR: dependency ‘e1071’ is not available for package ‘tableone’
> * removing ‘/Users/hanan/opt/anaconda3/lib/R/library/tableone’
> 
> The downloaded source packages are in
> 	‘/private/var/folders/7l/27620by50812sxd514rjz_840000gn/T/Rtmpl8fkJG/downloaded_packages’
> Updating HTML index of packages in '.Library'
> Making 'packages.html' ... done
> Warning messages:
> 1: In install.packages("tableone") :
>   installation of package ‘e1071’ had non-zero exit status
> 2: In install.packages("tableone") :
>   installation of package ‘tableone’ had non-zero exit status

Found a solution.
REMOVE Anaconda R-Studio Installation.
Install R-Studio from official website.
conda uninstall r
conda uninstall r-base

make sure r in console which r directs to /usr/local/bin/r

Then follow the instructions here to connect conda jupyter notebook to the installed R
https://developers.refinitiv.com/article/setup-jupyter-notebook-r

2 Likes

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