运行安装在conda中的R,安装devtools时报错
Warning messages:
1: In install.packages("devtools") :
installation of package ‘systemfonts’ had non-zero exit status
2: In install.packages("devtools") :
installation of package ‘textshaping’ had non-zero exit status
3: In install.packages("devtools") :
installation of package ‘ragg’ had non-zero exit status
4: In install.packages("devtools") :
installation of package ‘pkgdown’ had non-zero exit status
5: In install.packages("devtools") :
installation of package ‘devtools’ had non-zero exit status
安装缺少的依赖包install.packages("systemfonts")报错
In file included from caches.h:7,
from caches.cpp:1:
ft_cache.h:9:10: fatal error: ft2build.h: No such file or directory
9 | #include <ft2build.h>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [/home/ubuntu/miniconda3/envs/R/lib/R/etc/Makeconf:200: caches.o] Error 1
ERROR: compilation failed for package ‘systemfonts’
* removing ‘/home/ubuntu/miniconda3/envs/R/lib/R/library/systemfonts’
The downloaded source packages are in
‘/tmp/RtmprDf2Iy/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("systemfonts") :
installation of package ‘systemfonts’ had non-zero exit status
主要问题是:ft_cache.h:9:10: fatal error: ft2build.h: No such file or directory,参考该链接方法(https://www.jianshu.com/p/8efd3c998282),发现是systemfonts编译过程中需判断是否支持pkg-config,因此是缺少pkg-config导致,安装后再次安装R包则成功
conda install pkg-config
R
install.packages("systemfonts")
接着安装devtools缺的其它几个依赖包,估计是和systemfonts一样的问题,解决了systemfonts的问题后,其它几个包也均安装成功
install.packages("textshaping")
install.packages("ragg")
install.packages("pkgdown")
#缺的依赖包装完后,再次安装devtools
install.packages("devtools")
成功安装!