astamm / nloptr

nloptr provides an R interface to NLopt, a free/open-source library for nonlinear optimization providing a common interface to a number of different optimization routines which can handle nonlinear constraints and lower and upper bounds for the controls.
https://astamm.github.io/nloptr/
Other
106 stars 34 forks source link

On OSX, updating system nlopt causes R's nloptr to break #173

Closed GabrielHoffman closed 2 hours ago

GabrielHoffman commented 3 hours ago

On macOS Sonoma 14.7.1 with R 4.4.1, I started off with a normal working install of nloptr and lme4. I updated some system packages with brew, not expecting any effect on R packages. After updating, brew had installed nlopt 2.9.0. (The version number is confusing, but that is what brew says: https://formulae.brew.sh/formula/nlopt).

Then I noticed that lme4 was failing for simple examples. See bug report. After a lot of digging, re-installing nloptr resolved the issue.

My issue is resolved, but I want to post here since I was surprised that updating a system version of nlopt would break an R version of nloptr

Best, Gabriel

eddelbuettel commented 3 hours ago

This can happen (theoretically and practically) with dynamic linking but it is rare in practice as library interfaces and behavior tend to be stable. nloptr tries to straddle a balance of making installing easier and faster (by relying on a system library), other packages vendor. (And on other OSs you get static linking only....)

eddelbuettel commented 2 hours ago

If you can distill out a minimally veriable reproducible example (ideally not involving lme4) we could augment the unit tests.