Unable to install lme4

Hi all, I am not able to install lme 4, can you kindly help me sort this out? My R version is 2024.09.0+375, see below for the warning/error

ld: warning: -single_module is obsolete
ld: warning: -multiply_defined is obsolete
ld: warning: search path '/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0' not found
ld: warning: search path '/usr/local/gfortran/lib' not found
ld: library 'gfortran' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [RcppEigen.so] Error 1
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/Users/jdai/Library/R/x86_64/4.2/library/RcppEigen’
ERROR: dependencies ‘minqa’, ‘nloptr’, ‘RcppEigen’ are not available for package ‘lme4’
* removing ‘/Users/jdai/Library/R/x86_64/4.2/library/lme4’

The downloaded source packages are in
	‘/private/var/folders/nb/8lh76kw93qj4rlk9mvp58sr00000gp/T/RtmpShDKPE/downloaded_packages’
Warning messages:
1: In utils::install.packages("lme4", type = "source") :
  installation of package ‘minqa’ had non-zero exit status
2: In utils::install.packages("lme4", type = "source") :
  installation of package ‘nloptr’ had non-zero exit status
3: In utils::install.packages("lme4", type = "source") :
  installation of package ‘RcppEigen’ had non-zero exit status
4: In utils::install.packages("lme4", type = "source") :
  installation of package ‘lme4’ had non-zero exit status

Hi @JDinAcademia -

The error message tells you the issue, which is you are missing a necessary library to compile the package (gfortran).

I'm guessing you're using a Mac (based on the paths), which if you are using Homebrew for package installation can be installed using brew install gcc

Best,
Randy

Your development environment is incomplete.

I would advise not to use Homebrew for this, but install the Xcode command line tools, and also the fortran compiler linked from Tools - R for Mac OS X - developer's page - GNU Fortan for Xcode which is the same compiler that CRAN uses to build R in the first place.

1 Like

still the same error, after I installed gfortran (still telling me not found)

I have this installed already through the terminal, but still having the same issue

Try uninstalling gfortran 8.2.x, that's not the version you need, probably.

Or maybe that's the one you need, and it is not installed.

2024.09.0+375 is your version of RStudio, not R. You have R 4.2, while the current version is 4.4. There are binary versions of lme4 and its dependencies on CRAN for R 4.4 ("release" version) and R 4.3 ("oldrel" version). Updating to a newer version of R would make life easier!

While I followed the instructions on the R for macOS site suggested by Gabor, I only compile source code when necessary, such as development versions of R packages.

1 Like

thank you ! all solved!

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.