Sto cercando di installare il pacchetto RNetCDF sul mio portatile (Ubuntu 12.04) con il comandoRNetCDF non può aprire il file oggetto condiviso
install.packages('RNetCDF',lib='/home/my_computer/RSCRIPTS/R_LIB/',configure.args="--with-netcdf-include='/home/my_computer/bin/libs4cdo-0.0.10/netcdf-4.2/include/' --with-netcdf-lib='/home/my_computer/local/bin' --with-hdf5-lib='/home/my_computer/local/lib/' --with-udunits-include='/usr/local/lib/' --with-udunits-lib='/usr/local/lib/'",repos='http://star-www.st-andrews.ac.uk/cran/')
ma il pacchetto non verrà installato. Vedere il messaggio di seguito:
trying URL 'http://star-www.st-andrews.ac.uk/cran/src/contrib/RNetCDF_1.6.1-2.tar.gz'
Content type 'application/x-gzip' length 70301 bytes (68 Kb)
opened URL
==================================================
downloaded 68 Kb
* installing *source* package ‘RNetCDF’ ...
** package ‘RNetCDF’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for nc_open in -lnetcdf... yes
checking for utInit in -ludunits2... no
checking for utScan in -ludunits2... yes
checking how to run the C preprocessor... gcc -std=gnu99 -E
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 netcdf.h usability... yes
checking netcdf.h presence... yes
checking for netcdf.h... yes
checking udunits.h usability... yes
checking udunits.h presence... yes
checking for udunits.h... yes
configure: creating ./config.status
config.status: creating R/load.R
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -I/usr/local/lib/ -I/home/bauduinm/bin/libs4cdo-0.0.10/netcdf-4.2/include/ -fpic -O3 -pipe -g -c RNetCDF.c -o RNetCDF.o
gcc -std=gnu99 -shared -o RNetCDF.so RNetCDF.o -ludunits2 -lnetcdf -L/home/my_computer/local/lib/ -L/usr/local/lib/ -L/home/my_computer/local/bin -lexpat -L/usr/lib/R/lib -lR
installing to /home/my_computer/RSCRIPTS/R_LIB/RNetCDF/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/my_computer/RSCRIPTS/R_LIB/RNetCDF /libs/RNetCDF.so':
libexpat.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/my_computer/RSCRIPTS/R_LIB/RNetCDF’
The downloaded packages are in
‘/tmp/Rtmpl5MniY/downloaded_packages’
Warning message:
In install.packages("RNetCDF", lib = "/home/my_computer/RSCRIPTS/R_LIB/", :
installation of package ‘RNetCDF’ had non-zero exit status
Quando provo con
sudo R CMD INSTALL --libary='/home/my_computer/RSCRIPTS/R_LIB/' --configure-args="--with-netcdf-include='/home/my_computer/bin/libs4cdo-0.0.10/netcdf-4.2/include/' --with-netcdf-lib='/home/my_computer/local/lib/' --with-hdf5-lib='/home/my_computer/local/lib/' --with-udunits-include=/usr/local/lib/ --with-udunits-lib=/usr/local/lib/" /home/my_computer/Downloads/RNetCDF_1.6.1-2.tar.gz
il messaggio di errore viene sostituito con
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/site-library/RNetCDF/libs/RNetCDF.so':
libnetcdf.so.7: cannot open shared object file: No such file or directory
libnetcdf.so.7 è sicuramente in /home/my_computer/local/lib/
che è anche il mio LD_LIBRARY_PATH
. Certo, il libexpat.so.0, che è uno dei file nel primo messaggio di errore (con install.packages
), si trova nelle cartelle relative intel che non sembrano avere nulla a che fare con le librerie netcdf.
Qualcuno potrebbe illuminarmi?
Grazie.
Edit: Beh, non lo saprò mai quello che è successo, perché quando ho riprovato 3 giorni più tardi con la stessa identica linea di install.packages
di comando il pacchetto installato senza problemi di sorta ... Quindi il mio unico consiglio a qualcuno che può avere la lo stesso problema è disconnettersi da R e ricominciare, nel caso in cui alcuni errori precedenti nella sessione rimanessero nel registro.
Nel tuo primo tentativo, quando non riesce a caricare la libreria, ha veramente uno spazio in questo percorso: '/ home/mio_computer/RSCRIPTS/R_LIB/RNetCDF/libs/RNetCDF.so', oppure è una formattazione problema quando lo hai incollato in SO? – nograpes
Inoltre, leggi [questo post] (http://ubuntuforums.org/showthread.php?t=1034715) sul collegamento di 'libexpat.so.0'. Potresti voler usare un link per indirizzare il pacchetto nella giusta posizione (come mostrato nel post), se hai una versione più recente installata, cosa che sospetto che tu faccia. – nograpes
'@ nograpes' Grazie per i vostri commenti. Questo mi ha costretto a guardare il problema dello spazio (che era una formattazione nel problema SO), rieseguire la riga di comando e ho capito che avrei potuto installare il pacchetto senza problemi oggi. – SnowFrog