-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On OSX, updating system nlopt causes R's nloptr to break #173
Comments
This can happen (theoretically and practically) with dynamic linking but it is rare in practice as library interfaces and behavior tend to be stable. |
If you can distill out a minimally veriable reproducible example (ideally not involving |
That you encountered a problem mixing CRAN and Homebrew binaries isn't particularly surprising. It's documented that if you obtain R for macOS from CRAN, then you must use Apple's native tools for package installation, linking libraries provided by (or built, using the same native tools, as documented by) CRAN at https://mac.r-project.org/bin/. Conversely, if you obtain R from Homebrew, then you ought to use tools and libraries from Homebrew. Your https://cran.r-project.org/bin/macosx/
https://cran.r-project.org/doc/manuals/r-release/R-admin.html#macOS-packages
https://mac.r-project.org/tools/
|
I've just installed (under macOS, from sources) nlopt versions 2.8.0, 2.9.0, and 2.9.1. Under each version, I re-installed nloptr then debugged lme4. The breakage happens in version 2.9.0 (https://github.com/stevengj/nlopt/releases/tag/v2.9.0), but I'll just show you a comparison of 2.8.0 and 2.9.1. 2.8.0:
2.9.1:
An example independent of lme4 would be nice. It's too bad that the objective function in this case can't be cut and pasted:
But there is more to investigate because the starting values of these two optimizations are somehow different. So the breakage is probably upstream of the call to |
Actually, under nlopt 2.8.0, the value of
|
Yikes
…On Thu, Dec 12, 2024, 10:54 AM Mikael Jagan ***@***.***> wrote:
But there is more to investigate because the starting values of these two
optimizations are somehow different. So the breakage is probably upstream
of the call to nloptwrap that I've debugged. I'll dig a bit more later.
Actually, under nlopt 2.8.0, the value of par in the evaluation frame of
lme4::nloptwrap differs before and after the call to nloptr::nloptr,
suggesting that either *nloptr* or *lme4* is failing to copy before
modifying. Just trying the first example in help("nloptr") suggests to me
that *nloptr* is not the culprit. My naive guess is that changes in nlopt
2.9.0 have exposed a low level behaviour of *lme4*. FYI @bbolker
<https://github.com/bbolker>
—
Reply to this email directly, view it on GitHub
<#173 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAATIRT7ZASGQ6A3FTBJJSD2FGWULAVCNFSM6AAAAABSC3GDT2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZZGM2TENZUGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
For those of us less fluent in |
Sorry, I've not had time to dig further and clarify things. I'd hoped that I'd left enough breadcrumbs. I'll try to look again soon. Luckily no fallout on CRAN yet, seemingly because the check machines are not yet getting nlopt >= 2.9. But I know that the Fedora machines are going to be upgraded to F40 soon, and nlopt >= 2.9 is being built there ... https://packages.fedoraproject.org/pkgs/NLopt/NLopt-devel/ Debian seems slower: https://packages.debian.org/trixie/libnlopt-dev The Windows and macOS machines are using 2.8.0 and 2.7.1, respectively: https://svn.r-project.org/R-dev-web/trunk/WindowsBuilds/winutf8/ucrt3/toolchain_libs/mxe/src/nlopt.mk FreeBSD, though not tested by CRAN, is already at 2.9.1: |
Entertainingly, https://nlopt.readthedocs.io/ (which certainly looks official) reports 2.7.1 as being the latest version ... the NEWS file doesn't list anything that looks like it should make a difference, but obviously you're seeing something real. I'll dig into this when I get a chance (hopefully, soon). |
For Windows, maybe we can ask @kalibera for a version of Rtools with nlopt 2.9.1 and see if nloptr "survives"? |
Or use a container and install |
Containers had occurred to me: I'll try this when I get a chance. |
Check logs under today's R-devel, if it saves people time ... Both lme4 and nloptr show new problems when checked under nlopt 2.9.1. I'd still guess (based on the debugging output from December) that the new problems in lme4 are due to low level assumptions of lme4 itself, not due to any problem in nloptr. 00check.lme4_1.1-36_nlopt_2.8.0.log |
To summarize:
|
Yup, that's the test for PRAXIS, which was changed by @jschueller in stevengj/nlopt#528. Now we have to figure out WHAT was changed and how to fix it. |
sigh, that strengthens @jaganmn's argument that there is really something wrong in |
Re: nloptr It seems that parameter Lines 284 to 296 in 6d4943a
More precisely, when nloptr is built against nlopt >= 2.9, the branch condition can be true even where Applying that patch gets you past the original error while uncovering a bunch of other differences ...
I would start by submitting to the NLopt maintainers a minimal reproducible example showing that |
Hi, @jaganmn. May I request that you open the issue with nlopt, being that right now you have the clearest understanding of what happened? |
The behaviour that I reported in my last comment was not reproducible independently of nloptr, leading me to discover that all of these problems are due to a mistake in nloptr's Autoconf machinery. In
implying that I imagine that a suitable patch for Note that you use |
this is consistent at least with the NLOPT_INVALID_ARGS error ... |
Wow, nice work. Part of it is clearly also
Such mixing is almost always a bad idea so when system linking is done system headers should be used. I see no |
It's in the tarball that I downloaded from CRAN. git-blame suggests maintainer thinko? Lines 2 to 4 in 6d4943a
|
You are pointing at Because indeed, this looks like a mistake: edd@rob:/tmp/r$ wget -q https://cloud.r-project.org/src/contrib/nloptr_2.1.1.tar.gz
edd@rob:/tmp/r$ tar tvzf nloptr_2.1.1.tar.gz | grep inst/include
drwxr-xr-x ligges/users 0 2022-01-20 01:19 nloptr/inst/include/
-rw-r--r-- ligges/users 3925 2024-06-24 10:47 nloptr/inst/include/nlopt.f
-rw-r--r-- ligges/users 15819 2024-06-24 10:47 nloptr/inst/include/nlopt.h
-rw-r--r-- ligges/users 22423 2024-06-24 10:47 nloptr/inst/include/nlopt.hpp
-rw-r--r-- ligges/users 18345 2022-01-20 01:19 nloptr/inst/include/nloptrAPI.h
edd@rob:/tmp/r$ |
Wow. Thank you very much!!
Hmmm, that was a change in 2.9.0 <Dropped unused LD_LBFGS_NOCEDAL enum value>. Being that it was mooted, I vote that we simply check for that string and return an error. @jaganmn, thank you again for your time and expertise! |
More or less. I just meant that I can see how the files might have been overlooked at the time, given that git was asked to ignore them and that they are located in a directory that |
@astamm, we should reopen this issue until the configuration and anything else necessary is completed. |
It seems a lot has been discussed already. I agree that priority is to make nloptr work as is with latest nlopt version. Then, I'll get to the other PRs. I have a larger bandwidth in the next months to look into all this. |
Interestingly, the version of nlopt in Rtools44 is 2.8.0 per the news. I emailed R-sig-windows asking that it not be updated beyond 2.8.0 until we work this out. |
This may help us. I'd prefer someone who knows C better than I work on it, but if no one else will, I will try: |
The nlopt project reversed that commit!! @jaganmn, may I trouble to run the test that failed and see if nlopt 2.10 passes now? |
Ace! That is good news. We should however also clean up the issue uncovered by @jaganmn (see comment above) and not leave 'random' nlopt header files around which was part of the hickup we saw here. Header and library version must mix, keeping one half around asks for trouble. |
Yes, I'll try to do that this week some time. But I should repeat that, strictly speaking, the ABI-breaking change in nlopt would not have broken nloptr so badly (if at all) if not for the bug in nloptr that I described. Specifically, |
Exactly correct statement by @jaganmn |
On macOS Sonoma 14.7.1 with R 4.4.1, I started off with a normal working install of
nloptr
andlme4
. I updated some system packages withbrew
, not expecting any effect on R packages. After updating,brew
had installednlopt
2.9.0. (The version number is confusing, but that is whatbrew
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-installingnloptr
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 ofnloptr
Best,
Gabriel
The text was updated successfully, but these errors were encountered: