2016-07-12 19 views
7

Un'altra richiesta di aiuto per l'installazione del pacchetto nloptr su Linux (Ubuntu 14.04.4 LTS). Ho esaminato molte domande ma non sono riuscito a trovare una soluzione per questo.Installazione di nloptr su Linux - errore irreversibile: nlopt.h: nessun file o directory

Non riesco a installare il pacchetto lme4 in R (versione 3.3.1/Rstudio versione 0.99.902) poiché l'installazione di nloptr ha uno stato di uscita diverso da zero. Quando provo

install.package("nloptr") 

ottengo il seguente:

Installing package into ‘/home/rd14/R/x86_64-pc-linux-gnu-library/3.3’ 
(as ‘lib’ is unspecified) 
trying URL 'https://cran.rstudio.com/src/contrib/nloptr_1.0.4.tar.gz' 
Content type 'unknown' 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... /bin/grep 
checking for egrep... /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... no 
checking nlopt.h presence... no 
checking for nlopt.h... no 
configure: Need to download and build NLopt 
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz' 
Content type 'application/x-gzip' length 2361992 bytes (2.3 MB) 
================================================== 
downloaded 2.3 MB 

configure: Starting to install library to /tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2 
configure: Done installing library to /tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2 
configure: creating ./config.status 
config.status: creating src/Makevars 
** libs 
g++ -I/usr/share/R/include -DNDEBUG  -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c dummy.cpp -o dummy.o 
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG  -I/tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c nloptr.c -o nloptr.o 
nloptr.c:42:19: fatal error: nlopt.h: No such file or directory 
#include "nlopt.h" 
       ^
compilation terminated. 
make: *** [nloptr.o] Error 1 
ERROR: compilation failed for package ‘nloptr’ 
* removing ‘/home/rd14/R/x86_64-pc-linux-gnu-library/3.3/nloptr’ 
Warning in install.packages : 
    installation of package ‘nloptr’ had non-zero exit status 

The downloaded source packages are in 
    ‘/tmp/Rtmp4Y3TXJ/downloaded_packages’ 

Il vostro aiuto sarà molto apprezzato! Grazie.

+0

Qual è il tuo sistema? –

+0

Ubuntu 14.04.4 LTS – user1442363

+0

puoi trovare qualcosa in /tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2/include, oppure i file temporanei sono stati cancellati dopo che il processo di installazione non è riuscito? –

risposta

10

Quando Jelmer e io abbiamo sviluppato questa configurazione, ha funzionato sulle mie macchine Ubuntu, e continua a farlo - con il download e la build di nlopt o tramite la libreria di sistema.

Come in Ubuntu, la soluzione più semplice è probabilmente installare la libreria di sistema nlopt, che verrà rilevata e utilizzata dal pacchetto nloptr. Quindi

sudo apt-get install libnlopt-dev 

e quindi provare a installare nuovamente nlopt.

Analogamente, dovresti essere in grado di ottenere lme4 come r-cran-lme4 dai PPA appropriati di Michael Rutter come descritto nello README for Ubuntu in CRAN.

+0

Stavo cercando di installare il pacchetto 'carets' in R 3.4.0, ma non sono riuscito a completare l'installazione perché' nloptr' mi dava un errore. Dopo aver provato questa soluzione, ha funzionato !! –

Problemi correlati