Установка «ncdf» на R, когда у меня нет прав суперпользователя

У меня есть доступ к суперкомпьютеру, для которого у меня нет прав суперпользователя. На машине доступны версии 3 и 4 netcdf, но я не знаю, есть ли на ней библиотеки разработки, необходимые R для установки ncdf. Обычно я использую его для запуска параллельного кода R. Обычно я могу устанавливать пакеты в личную библиотеку, которая отлично работает. Например.:

> install.packages('plm')
Installing package(s) into '/home/diag/opt/R/local/lib'
(as 'lib' is unspecified)
Warning in install.packages("plm") :
  'lib = "/home/diag/opt/R/local/lib"' is not writable
Would you like to use a personal library instead?  (y/n) 

Мне нужен пакет ncdf, но я не могу его установить, потому что машина не может найти некоторые библиотеки netcdf, от которых зависит ncdf. На машине доступны версии 3 и 4 netcdf, но я не знаю, есть ли на ней библиотеки разработки, необходимые R для установки ncdf, и не знаю, как это проверить. Я работаю в условиях крайнего срока, и, к сожалению, администраторы не смогли помочь мне решить проблему.

Вот что происходит, когда я пытаюсь установить ncdf:

[andrewcd@computer-login2 ~]$ module load R
[andrewcd@computer-login2 ~]$ module load netcdf/3.6.2
[andrewcd@computer-login2 ~]$ R           

R version 2.15.2 (2012-10-26) -- "Trick or Treat"

...(резать)

Type 'q()' to quit R.

[Previously saved workspace restored]

> install.packages('ncdf')
Installing package(s) into '/home/diag/opt/R/local/lib'
(as 'lib' is unspecified)
Warning in install.packages("ncdf") :
  'lib = "/home/diag/opt/R/local/lib"' is not writable
Would you like to use a personal library instead?  (y/n) y
--- Please select a CRAN mirror for use in this session ---
CRAN mirror 

 1: 0-Cloud                       2: Argentina (La Plata)       

...(резать)

91: Vietnam                      

Selection: 75
trying URL 'http://cran.stat.ucla.edu/src/contrib/ncdf_1.6.6.tar.gz'
Content type 'application/x-tar' length 79403 bytes (77 Kb)
opened URL
==================================================
downloaded 77 Kb

* installing *source* package 'ncdf' ...
** package 'ncdf' successfully unpacked and MD5 sums checked
checking for nc-config... no
checking for gcc... gcc -std=gnu99
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 gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
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... no
checking netcdf.h presence... no
checking for netcdf.h... no
configure: error: netcdf header netcdf.h not found
ERROR: configuration failed for package 'ncdf'
* removing '/home/andrewcd/R/x86_64-unknown-linux-gnu-library/2.15/ncdf'

The downloaded source packages are in
    '/tmp/RtmpIDiTdL/downloaded_packages'
Warning message:
In install.packages("ncdf") :
  installation of package 'ncdf' had non-zero exit status

Кто-нибудь знает, что я могу сделать, чтобы R мог найти необходимые библиотеки?

Также обратите внимание, что я бы предпочел использовать ncdf, а не ncdf4 (для совместимости с существующим кодом). Однако, когда я пытаюсь установить ncdf4, я получаю следующее сообщение об ошибке, которое может быть поучительным:

* installing *source* package 'ncdf4' ...
** package 'ncdf4' successfully unpacked and MD5 sums checked
checking for nc-config... no
-----------------------------------------------------------------------------------
Error, nc-config not found or not executable.  This is a script that comes with the
netcdf library, version 4.1-beta2 or later, and must be present for configuration
to succeed.

If you installed the netcdf library (and nc-config) in a standard location, nc-config
should be found automatically.  Otherwise, you can specify the full path and name of
the nc-config script by passing the --with-nc-config=/full/path/nc-config argument
flag to the configure script.  For example:

./configure --with-nc-config=/sw/dist/netcdf4/bin/nc-config

Special note for R users:
-------------------------
To pass the configure flag to R, use something like this:

R CMD INSTALL --configure-args="--with-nc-config=/home/joe/bin/nc-config" ncdf4

where you should replace /home/joe/bin etc. with the location where you have
installed the nc-config script that came with the netcdf 4 distribution.
-----------------------------------------------------------------------------------
ERROR: configuration failed for package 'ncdf4'
* removing '/home/andrewcd/R/x86_64-unknown-linux-gnu-library/2.15/ncdf4'

The downloaded source packages are in
    '/tmp/RtmpIDiTdL/downloaded_packages'
Warning message:
In install.packages("ncdf4") :
  installation of package 'ncdf4' had non-zero exit status

Очевидно, что система не может найти «nc-config». (сам не могу найти).

Буду очень признателен за любые советы о том, что я могу сделать, или о том, что я могу попросить суперпользователя сделать для меня.


person generic_user    schedule 02.04.2013    source источник
comment
Дополнительное примечание для людей, у которых действительно есть проблема с установкой из-за отсутствия прав на запись в каталоге библиотеки по умолчанию: в файле .Rprofile (например, поместить его в ~/.R/.Rprofile) вы можете вставить функцию .First, с помощью которой вы установите папку lib по вашему выбору. Например: .First = function() {.libPaths('~/.R/libs')}. Вы должны создать ~/.R/libs самостоятельно.   -  person daniel.heydebreck    schedule 06.06.2017
comment
Исправление: поместите .Rprofile в ~/.Rprofile   -  person daniel.heydebreck    schedule 06.06.2017


Ответы (1)


Привет, я думаю, что ошибка, которую вы получаете при установке 'ncdf':

configure: error: netcdf header netcdf.h not found

Вы должны установить пакет Linux, который содержит заголовочный файл netcdf.h. Вам может потребоваться доступ суперпользователя, чтобы сделать то же самое. Если у вас есть доступ суперпользователя, вы можете выполнить поиск в репозитории вашего Linux-дистрибутива, который предоставляет этот заголовочный файл, и установить его.

person donut    schedule 02.04.2013