繁体   English   中英

在 R studio 中安装包“ncdf4”失败

[英]Failed installation of package "ncdf4" in R studio

我正在尝试安装一个名为“ncdf4”的 R 包。 我试过在 R-studio 界面的“packages”部分安装它,但也试过在控制台中输入install.packages("ncdf4")

这是我在两种情况下得到的输出:

Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/ncdf4_1.17.tar.gz'
Content type 'application/x-gzip' length 124458 bytes (121 KB)
==================================================
downloaded 121 KB

* installing *source* package ‘ncdf4’ ...
** package ‘ncdf4’ successfully unpacked and MD5 sums checked
** using staged installation
configure.ac: starting
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/user/R/x86_64-pc-linux-gnu-library/3.6/ncdf4’
Warning in install.packages :
  installation of package ‘ncdf4’ had non-zero exit status

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

有没有人能够从我提供的代码中破译出了什么问题? 谢谢。

我终于设法安装了 ncdf4。

我在这里读到类似的问题: https : //r.789695.n4.nabble.com/Problem-installing-ncdf-library-td4646986.html

我通过键入以下sudo apt install libnetcdf-*在 linux 终端中安装了所有libnetcdf包: sudo apt install libnetcdf-*

如果您运行的是 Ubuntu18.04 或其派生版本,您可以通过执行以下操作来查找库netcdf4.1

sudo apt-cache search libnetcdf

在我的会话(Linux Mint)中,我得到:

libnetcdf-c++4 - legacy NetCDF C++ interface
libnetcdf-c++4-1 - C++ interface for scientific data access to large binary data
libnetcdf-c++4-dbg - debugging symbols for NetCDF C++
libnetcdf-c++4-dev - creation, access, and sharing of scientific data in C++
libnetcdf-c++4-doc - NetCDF C++ API documentation
libnetcdf-cxx-legacy-dbg - debugging symbols for legacy NetCDF C++ interface
libnetcdf-cxx-legacy-dev - legacy NetCDF C++ interface - development files
libnetcdf-dev - creation, access, and sharing of scientific data
libnetcdf13 - Interface for scientific data access to large binary data
libnetcdff-dbg - debugging symbols for NetCDF Fortran
libnetcdff-dev - creation, access, and sharing of scientific data in Fortran
libnetcdff-doc - NetCDF Fortran documentation
libnetcdff6 - Fortran interface for scientific data access to large binary data

因此,安装libnetcdf-c++4-1应该可以解决您的问题:

sudo apt-get update
sudo apt-get install libnetcdf-c++4-1

它回答你的问题吗?

我正在使用 Ubuntu 20.4 并遇到了同样的问题。

第 1 步:在终端中

    sudo apt-get update -y

第二步:在终端

    sudo apt-get install -y libnetcdf-dev

第 3 步:在 rstudio

    install.packages("ncdf4")

之后ncdf4安装成功

参考: https : //zoomadmin.com/HowToInstall/UbuntuPackage/libnetcdf-dev

对于 Arch Linux 用户,您可能还没有安装netcdf 您可以使用pacman安装netcdf

sudo pacman -S netcdf

只需通过 apt 安装 netcdf

apt-get install libnetcdf-dev

它对我有用(ubuntu 20.04 和 R 4)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM