0

I am attempting to install the ivreg package into R (4.0.3) on my Mac (OS Big Sur Intel Version 11.6.8)

I am having what apparently is a fairly common problem installing its dependencies, but I am receiving a slightly different error message. My error message from the command install.packages('ivreg'):

clang: error: -E or -x required when input is from standard input
clang: error: no such file or directory: 'L/usr/local/gfortran/lib'
make: *** [Matrix.so] Error 1
ERROR: compilation failed for package ‘Matrix’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Matrix’
* restoring previous 
‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Matrix’
Warning in install.packages :
installation of package ‘Matrix’ had non-zero exit status
* installing *source* package ‘MatrixModels’ ...
** package ‘MatrixModels’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
namespace ‘Matrix’ 1.2-18 is being loaded, but >= 1.4.2 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package ‘MatrixModels’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/MatrixModels’
Warning in install.packages :
installation of package ‘MatrixModels’ had non-zero exit status
ERROR: dependency ‘MatrixModels’ is not available for package ‘quantreg’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/quantreg’
Warning in install.packages :
installation of package ‘quantreg’ had non-zero exit status
ERROR: dependency ‘quantreg’ is not available for package ‘car’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/car’
Warning in install.packages :
installation of package ‘car’ had non-zero exit status

The instrumental bit appears to be the very first two lines, where it's describing something about a gfortran directory. I've tried to install gfortran as well as all of the other dependencies to no avail. When I attempt to do so, I'm told that the packages are unavailable for my version of R.

QUESTION: Is there a way to alleviate this error and install ivreg on my machine?

Isaiah
  • 2,091
  • 3
  • 19
  • 28
JRR
  • 578
  • 5
  • 21
  • Since you seem to already have installed gfortran, maybe you just need to set it on the PATH. This answer shows how to, and suggests to install gcc: https://stackoverflow.com/a/72200132/6574038 – jay.sf Dec 01 '22 at 06:28
  • There are many ways to screw up installation of gfortran. We cannot tell which error you encountered from the information offered. A common way to screw up is to mix the CRAN version of R and the home brew version of gfortran (or vice versa). Another way is to get the wrong version. The safe way is to read the instructions carefully. https://cran.r-project.org/bin/macosx/ – IRTFM Dec 01 '22 at 07:09

0 Answers0