【问题标题】:How install R package "udunits2" in Ubuntu如何在 Ubuntu 中安装 R 包“udunits2”
【发布时间】:2018-04-14 01:05:45
【问题描述】:

我正在尝试在 Ubuntu 上安装 R 包 udunits2

sudo su - -c "R -e \"install.packages('udunits2', repos='http://cran.rstudio.com/')\""

但我遇到了错误:

R version 3.4.2 (2017-09-28) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages('udunits2', repos='http://cran.rstudio.com/')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/udunits2_0.13.tar.gz'
Content type 'application/x-gzip' length 67182 bytes (65 KB)
==================================================
downloaded 65 KB

* installing *source* package ‘udunits2’ ...
** package ‘udunits2’ successfully unpacked and MD5 sums checked
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 for XML_ParserCreate in -lexpat... 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 udunits2.h usability... yes
checking udunits2.h presence... yes
checking for udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c udunits2_R.c -o udunits2_R.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o udunits2.so udunits2_R.o -ludunits2 -lexpat -lexpat -ludunits2 -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/udunits2/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘udunits2’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/site-library/udunits2/libs/udunits2.so':
  libudunits2.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/udunits2’

The downloaded source packages are in
        ‘/tmp/Rtmp0X1Xn4/downloaded_packages’
Warning message:
In install.packages("udunits2", repos = "http://cran.rstudio.com/") :
  installation of package ‘udunits2’ had non-zero exit status

知道我应该如何进行吗?

【问题讨论】:

    标签: r ubuntu package


    【解决方案1】:

    您似乎缺少安装 R 包 udunits2 所需的包 libudunits2。尝试使用以下命令先安装它:

    sudo apt-get install libudunits2-dev
    

    希望这会有所帮助。

    【讨论】:

    • 谢谢!如果您能帮我在 Ubuntu 上升级 GDAL,那就太好了,目前它是 1.11.3,对于 sf 包,它应该大于 2。我读过 [launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable],但是当我尝试时:sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable 它返回错误: Cannot add PPA: 'ppa:~ubuntugis/ubuntu/ubuntugis-unstable'. ERROR: '~ubuntugis' user or team does not exist. 你有什么建议吗?
    • 嗨,阿里,恐怕我自己也不是 Ubuntu 专家,我只是知道够了。这有帮助吗:stackoverflow.com/questions/44382368/…>?否则,您可能会考虑将其作为关于 SO 的单独问题提出。
    • 非常感谢
    • 在 Mint 18.8 中运行良好非常感谢!
    • 你知道没有 sudo 权限我会怎么做吗?我在服务器上 - 谢谢!
    猜你喜欢
    • 2018-10-25
    • 2017-07-06
    • 2021-12-07
    • 2013-05-05
    • 1970-01-01
    • 1970-01-01
    • 2016-06-24
    • 2013-01-28
    • 1970-01-01
    相关资源
    最近更新 更多