Dear R-help members

Since this morning (5/2/2025), I get an error when I try to load optimx package. I solve it and I send my solution but if someone has a better idea or understand what's happened, I will be most happy to know.

MacOSX 15.3

R 4.4.2

nlopt installed using
brew install nlopt

Here are the steps to produce the error and a solution to solve it. Some parts are in French. I don't know how to "ask" to R to not use French for some system messages.

Marc


> library("optimx")
Erreur : le chargement du package ou de l'espace de noms a échoué pour ‘optimx’ in dyn.load(file, DLLpath = DLLpath, ...) : impossible de charger l'objet partagé '/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/nloptr/libs/nloptr.so' : dlopen(/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/nloptr/libs/nloptr.so, 0x0006): Library not loaded: /opt/homebrew/opt/nlopt/lib/libnlopt.0.dylib   Referenced from: <2A7DAFE2-8123-3555-9569-F28214328E47> /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/nloptr/libs/nloptr.so   Reason: tried: '/opt/homebrew/opt/nlopt/lib/libnlopt.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/nlopt/lib/libnlopt.0.dylib' (no such file), '/opt/homebrew/opt/nlopt/lib/libnlopt.0.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libnlopt.0.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk-11.0.18+10/Contents/Home/lib/server/libnlopt.0.d
It seems that the file libnlopt.0.dylib is not find.

When I check in this folder, indeed it is not present:

√ lib % cd /opt/homebrew/opt/nlopt/lib
√ lib % ls
cmake            libnlopt.1.dylib    pkgconfig
libnlopt.1.0.0.dylib    libnlopt.dylib

I create a symlink:

√ lib % sudo ln -s libnlopt.1.dylib libnlopt.0.dylib
Password:
√ lib % ls -al
total 880
drwxr-xr-x   8 marcgirondot  admin     256  5 fév 10:28 .
drwxr-xr-x  15 marcgirondot  admin     480  5 fév 10:26 ..
drwxr-xr-x   3 marcgirondot  admin      96  4 fév 19:29 cmake
lrwxr-xr-x   1 root          admin      16  5 fév 10:28 libnlopt.0.dylib -> libnlopt.1.dylib
-r--r--r--   1 marcgirondot  admin  447936  5 fév 10:26 libnlopt.1.0.0.dylib
lrwxr-xr-x   1 marcgirondot  admin      20  4 fév 19:29 libnlopt.1.dylib -> libnlopt.1.0.0.dylib lrwxr-xr-x   1 marcgirondot  admin      16  4 fév 19:29 libnlopt.dylib -> libnlopt.1.dylib
drwxr-xr-x   3 marcgirondot  admin      96  5 fév 10:26 pkgconfig

and I reinstall optimx from source

> remove.packages("optimx")
Elimination du package de ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library’
(car ‘lib’ n'est pas spécifié)
> install.packages("optimx", type="source")
essai de l'URL 'https://cran.irsn.fr/src/contrib/optimx_2024-12.2.tar.gz'
Content type 'application/x-gzip' length 2259525 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

* installing *source* package ‘optimx’ ...
** package ‘optimx’ correctement décompressé et sommes MD5 vérifiées
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (optimx)

Les packages source téléchargés sont dans
    ‘/private/tmp/Rtmpsb2lpE/downloaded_packages’

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to