Anaconda 环境下 R 包 ggraph_1.0.2 安装小记
由于微信不允许外部链接,你需要点击文章尾部左下角的 "阅读原文",才能访问文中链接。
记录一下今天在 Anaconda3 环境下 R==3.4.3 中安装 ggraph 的一些问题。
install.packages("ggraph") 发现 libudunits2.so was not found 错误:
> install.packages("ggraph")
......
checking for gcc... x86_64-conda_cos6-linux-gnu-cc
checking whether we are using the GNU C compiler... yes
checking whether x86_64-conda_cos6-linux-gnu-cc accepts -g... yes
checking for x86_64-conda_cos6-linux-gnu-cc option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking udunits2/udunits2.h usability... no
checking udunits2/udunits2.h presence... no
checking for udunits2/udunits2.h... no
checking for ut_read_xml in -ludunits2... no
configure: error: in `/tmp/RtmpDRI4FZ/R.INSTALL7d4f2d342516/units':
configure: error:
--------------------------------------------------------------------------------
Configuration failed because libudunits2.so was not found. Try installing:
* deb: libudunits2-dev (Debian, Ubuntu, ...)
* rpm: udunits2-devel (Fedora, EPEL, ...)
* brew: udunits (OSX)
If udunits2 is already installed in a non-standard location, use:
--configure-args='--with-udunits2-lib=/usr/local/lib'
if the library was not found, and/or:
--configure-args='--with-udunits2-include=/usr/include/udunits2'
if the header was not found, replacing paths with appropriate values.
You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.
--------------------------------------------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘units’
* removing ‘/usr/local/SoftWare/Anaconda3/lib/R/library/units’
ERROR: dependency ‘units’ is not available for package ‘ggforce’
* removing ‘/usr/local/SoftWare/Anaconda3/lib/R/library/ggforce’
ERROR: dependency ‘ggforce’ is not available for package ‘ggraph’
* removing ‘/usr/local/SoftWare/Anaconda3/lib/R/library/ggraph’
The downloaded source packages are in
‘/tmp/RtmpqBo0sm/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In install.packages("ggraph") :
installation of package ‘units’ had non-zero exit status
2: In install.packages("ggraph") :
installation of package ‘ggforce’ had non-zero exit status
3: In install.packages("ggraph") :
installation of package ‘ggraph’ had non-zero exit status
> install.packages("units")
......
checking for ut_read_xml in -ludunits2... no
configure: error: in `/tmp/Rtmp9xeJYe/R.INSTALL1e7523367a6/units':
configure: error:
--------------------------------------------------------------------------------
Configuration failed because libudunits2.so was not found. Try installing:
* deb: libudunits2-dev (Debian, Ubuntu, ...)
* rpm: udunits2-devel (Fedora, EPEL, ...)
* brew: udunits (OSX)
If udunits2 is already installed in a non-standard location, use:
--configure-args='--with-udunits2-lib=/usr/local/lib'
if the library was not found, and/or:
--configure-args='--with-udunits2-include=/usr/include/udunits2'
if the header was not found, replacing paths with appropriate values.
You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.
--------------------------------------------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘units’
* removing ‘/usr/local/SoftWare/Anaconda3/lib/R/library/units’
The downloaded source packages are in
‘/tmp/RtmpqBo0sm/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("units") :
installation of package ‘units’ had non-zero exit status
libudunits2.so not found,是 udunits2 相关的库存在问题,CentOS 下可以使用 sudo yum install udunits2-devel 解决,在这里也可以使用 conda 同时解决 units 安装及 udunits2 的库错误。
$ conda install r-units
#没有报错,正常安装成功
$ R
......
> library(units)
> install.packages("ggraph")
......
** R
** inst
** preparing package for lazy loading
Error : object ‘scale_type’ is not exported by 'namespace:ggplot2'
ERROR: lazy loading failed for package ‘ggforce’
* removing ‘/usr/local/SoftWare/Anaconda2/lib/R/library/ggforce’
ERROR: dependency ‘ggforce’ is not available for package ‘ggraph’
* removing ‘/usr/local/SoftWare/Anaconda2/lib/R/library/ggraph’
The downloaded source packages are in
‘/tmp/RtmpDK4vST/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In install.packages("ggraph") :
installation of package ‘ggforce’ had non-zero exit status
2: In install.packages("ggraph") :
installation of package ‘ggraph’ had non-zero exit status
> library(ggforce)
Error in library(ggforce) : there is no package called ‘ggforce’
> install.packages("ggforce")
......
** inst
** preparing package for lazy loading
Error : object ‘scale_type’ is not exported by 'namespace:ggplot2'
ERROR: lazy loading failed for package ‘ggforce’
* removing ‘/usr/local/SoftWare/Anaconda2/lib/R/library/ggforce’
......
> install.packages("ggplot2")
......
Error : object ‘enexprs’ is not exported by 'namespace:rlang'
ERROR: lazy loading failed for package ‘ggplot2’
......
从 rlang 开始,依次更新 rlang、ggplot2、ggforce 包。
> install.packages("rlang")
trying URL 'http://mirror.lzu.edu.cn/CRAN/src/contrib/rlang_0.2.2.tar.gz'
Content type 'application/octet-stream' length 325128 bytes (317 KB)
==================================================
downloaded 317 KB
......
> install.packages("ggplot2")
trying URL 'http://mirror.lzu.edu.cn/CRAN/src/contrib/ggplot2_3.0.0.tar.gz'
Content type 'application/octet-stream' length 2847050 bytes (2.7 MB)
==================================================
downloaded 2.7 MB
......
> install.packages("ggforce")
trying URL 'http://mirror.lzu.edu.cn/CRAN/src/contrib/ggforce_0.1.3.tar.gz'
Content type 'application/octet-stream' length 1489319 bytes (1.4 MB)
==================================================
downloaded 1.4 MB
......
最后,安装 ggraph,问题解决。
> install.packages("ggraph")
trying URL 'http://mirror.lzu.edu.cn/CRAN/src/contrib/ggraph_1.0.2.tar.gz'
Content type 'application/octet-stream' length 2607278 bytes (2.5 MB)
==================================================
downloaded 2.5 MB
....
> library(ggraph)
Loading required package: ggplot2
>
最后,简单总结一下:
ggraph_1.0.2 安装需要满足两个依赖:R (≥ 2.10), ggplot2 (≥ 2.0.0)。各种包相互依赖调用,根据 log 可定位哪一个包存在问题,然后逐一去解决。
object ‘enexprs’ is not exported by ‘namespace:rlang’,某个包(rlnag)无法加载特定对象(enexprs)可能有两个原因:
该包没有安装。
该包版本问题,导致目标对象(函数)发生增删处理。
·end·
—如果喜欢,快分享给你的朋友们吧—
我们一起愉快的玩耍吧
本文分享自微信公众号 - 生信科技爱好者(bioitee)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。