我没有超级用户权限时在R上安装'ncdf'

时间:2013-04-02 02:00:43

标签: r unix netcdf supercomputers

我可以访问超级计算机,我没有超级用户权限。该机器有netcdf版本3和4可用,但我不知道它是否有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包,但我无法安装它,因为机器找不到ncdf所依赖的某些netcdf库。该机器有netcdf版本3和4可用,但我不知道它是否有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”。 (我自己找不到。)

对于我能做什么,或者我可以要求超级用户为我做什么的任何建议,将不胜感激。

1 个答案:

答案 0 :(得分:1)

您好我认为您在安装'ncdf'时遇到的错误是:

configure: error: netcdf header netcdf.h not found

你必须安装contine netcdf.h头文件的linux pack。你可能需要超级用户访问来做同样的事情。 如果你有超级用户访问权限,那么你可以搜索linux destribtion的存储库,它提供这个头文件并安装它。