Проблема с установкой пакета nloptr на R 3.3.0

Я не могу установить пакет nloptr 1.0.4 на R 3.3.0. Сообщения следующие:

> install.packages("nloptr")
Installing package into ‘/Users/fgomesbarros/Library/R/3.3/library
(as ‘lib’ is unspecified)
trying URL 'https://cran.revolutionanalytics.com/src/contrib/nloptr_1.0.4.tar.gz'
Content type 'application/octet-stream' length 353942 bytes (345 KB)
==================================================
downloaded 345 KB

* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for pkg-config... yes
configure: Now testing for NLopt header file.
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking nlopt.h usability... yes
checking nlopt.h presence... yes
checking for nlopt.h... yes
configure: Suitable NLopt library found.
configure: creating ./config.status
config.status: creating src/Makevars
** libs
/usr/bin/clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/opt/local/include    -fPIC  -pipe -Os -arch x86_64 -stdlib=libstdc++  -c dummy.cpp -o dummy.o
/usr/bin/clang -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/opt/local/include    -fPIC  -pipe -Os -arch x86_64  -c nloptr.c -o nloptr.o
/usr/bin/clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/Library/Frameworks/R.framework/Resources/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -o nloptr.so dummy.o nloptr.o -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/fgomesbarros/Library/R/3.3/library/nloptr/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Users/fgomesbarros/Library/R/3.3/library/nloptr/libs/nloptr.so':
  dlopen(/Users/fgomesbarros/Library/R/3.3/library/nloptr/libs/nloptr.so, 6): Symbol not found: _nlopt_add_equality_mconstraint
  Referenced from: /Users/fgomesbarros/Library/R/3.3/library/nloptr/libs/nloptr.so
  Expected in: flat namespace
 in /Users/fgomesbarros/Library/R/3.3/library/nloptr/libs/nloptr.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/fgomesbarros/Library/R/3.3/library/nloptr’
* restoring previous ‘/Users/fgomesbarros/Library/R/3.3/library/nloptr’
Warning in install.packages :
  installation of package ‘nloptr’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/rz/dp6vmb39165406h9qv69q60c0000gn/T/RtmpLvLOmn/downloaded_packages’`

Моя версия R — 3.3.0, как вы можете видеть ниже:

> version
               _                           
platform       x86_64-apple-darwin12.6.0   
arch           x86_64                      
os             darwin12.6.0                
system         x86_64, darwin12.6.0        
status                                     
major          3                           
minor          3.0                         
year           2016                        
month          05                          
day            03                          
svn rev        70573                       
language       R                           
version.string R version 3.3.0 (2016-05-03)
nickname       Supposedly Educational      

Любые подсказки?

Я также пытался установить более старые версии (2.3.3 и 2.3.4) R и столкнулся с той же проблемой.

Заранее спасибо.


person Fabio Barros    schedule 24.05.2016    source источник
comment
Мне похоже, что вам может понадобиться обновить пакет Rcpp.   -  person Jeremy Miles    schedule 25.05.2016
comment
Тоже не уверен, но подозреваю, что может быть несовместимость частей пакета, скомпилированного/слинкованного со смесью clang и g++.   -  person RHertel    schedule 25.05.2016
comment
Rcpp актуален, Джереми.   -  person Fabio Barros    schedule 26.05.2016
comment
Как решить проблему несовместимости, RHertel?   -  person Fabio Barros    schedule 26.05.2016


Ответы (5)


Я смог решить проблему на своем Mac, используя

$ brew install nlopt

Изучая проблему, я заметил, что другие, как сообщается, решили проблему в Ubuntu, используя

$ sudo apt-get install libnlopt-dev

Очевидно, теперь вам нужно установить его вне R.

person Marshall Farrier    schedule 09.03.2018

Для меня, работающего с CentOS, недостающим кусочком головоломки было следующее:

     sudo yum install nlopt-devel
person Adi    schedule 08.09.2020

Я попытался переустановить пакет как root, и это сработало! Я не знаю почему.

person Fabio Barros    schedule 31.08.2016

Если вы столкнетесь с этой проблемой с nloptr 1.2.0 и R 3.5.1 в macOS High Sierra, brew install nlopt завершится ошибкой из-за неадекватных разрешений в /usr/local. Исправление:

$ mkdir /usr/local/Frameworks
$ sudo chown -R $(whoami) /usr/local/Frameworks
$ brew install nlopt

Другими словами, вы не хотите изменять разрешения для всего каталога /usr/local. Установка завершается сбоем, когда Homebrew пытается создать /usr/local/Framework. Итак, сделайте это вручную, как показано выше. Затем повторите попытку > install.packages("nloptr"). Это сработало для меня.

person Gabi    schedule 01.10.2018

Мне пришлось переустановить R, используя установщик R-CRAN и удалив пакет macports.

Наконец-то это сработало!

person Fabio Barros    schedule 18.06.2018