错误:配置包' ragg '失败

  • 本文关键字:ragg 失败 配置 错误 r
  • 更新时间 :
  • 英文 :

> install.packages("ragg")
trying URL 'https://cloud.r-project.org/src/contrib/ragg_1.1.3.tar.gz'
Content type 'application/x-gzip' length 420401 bytes (410 KB)
==================================================
downloaded 410 KB

Welcome at Tue Aug 17 23:24:09 2021
Library path: /home/roy/miniconda3/envs/r-4.1/lib/R/library
Repositories set.
R_MAX_NUM_DLLS set to 1000.
* installing *source* package ‘ragg’ ...
** package ‘ragg’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu
Using PKG_LIBS=-lfreetype -lpng16 -lm -lz -lm -lz -ltiff -lwebp -lzstd -llzma -ljbig -ljpeg -lz -lm
-----------------------------[ ANTICONF ]-------------------------------
Configuration failed to find one of freetype2 libpng libtiff-4. Try installing:
* deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
* rpm: freetype-devel libpng-devel libtiff-devel libjpeg-turbo-devel (Fedora, CentOS, RHEL)
* csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)
If freetype2 libpng libtiff-4 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a freetype2 libpng libtiff-4.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:361,
from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/limits.h:27,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:194,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/syslimits.h:7,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:34,
from /usr/include/libpng16/pngconf.h:31,
from /usr/include/libpng16/png.h:339,
from <stdin>:2:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:492:49: error: missing binary operator before token "("
492 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
|                                                 ^
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h:932,
from /usr/include/libpng16/pngconf.h:46,
from /usr/include/libpng16/png.h:339,
from <stdin>:2:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:228:17: error: missing binary operator before token "("
228 | #if __GLIBC_USE (DEPRECATED_GETS)
|                 ^
--------------------------------------------------------------------
ERROR: configuration failed for package ‘ragg’
* removing ‘/home/roy/miniconda3/envs/r-4.1/lib/R/library/ragg’
The downloaded source packages are in
‘/tmp/RtmpL1ZZnL/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("ragg") :
installation of package ‘ragg’ had non-zero exit status
会话信息
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.1.0 (2021-05-18)
#>  os       Ubuntu 20.04.2 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language en_GB:en                    
#>  collate  en_GB.UTF-8                 
#>  ctype    en_GB.UTF-8                 
#>  tz       Europe/Stockholm            
#>  date     2021-08-17                  

这个问题发生在conda环境中。安装了建议的linux库(见下文,在相同的conda环境中运行)。

sudo apt-get install -y libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev            
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libjpeg-dev is already the newest version (8c-2ubuntu8).
libpng-dev is already the newest version (1.6.37-2).
libfreetype6-dev is already the newest version (2.10.1-2ubuntu0.1).
libtiff5-dev is already the newest version (4.1.0+git191117-2ubuntu0.20.04.1).
0 to upgrade, 0 to newly install, 0 to remove and 26 not to upgrade.

ragg安装在conda环境之外工作正常。我的猜测是,当从conda环境安装时,它找不到某个路径。任何建议吗?

我看到了同样的错误。修复方法是将pkg-config安装到conda环境中:

conda install -c conda-forge pkg-config

conda环境下的R -c编译器似乎不能正确调用pkg-config系统。

看起来和这个问题的答案有关。我遇到了同样的问题,当试图安装"ragg"我的conda env内的包,并且日志中的建议修复(由@BlackBear回答提到)不是问题的真正原因,问题的原因显示在日志中:

-------------------------- [ERROR MESSAGE] ---------------------------
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:361,
from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/limits.h:27,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:194,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/syslimits.h:7,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:34,
from /usr/include/libpng16/pngconf.h:31,
from /usr/include/libpng16/png.h:339,
from <stdin>:2:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:492:49: error: missing binary operator before token "("
492 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
|                                                 ^
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h:932,
from /usr/include/libpng16/pngconf.h:46,
from /usr/include/libpng16/png.h:339,
from <stdin>:2:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:228:17: error: missing binary operator before token "("
228 | #if __GLIBC_USE (DEPRECATED_GETS)
|                 ^
--------------------------------------------------------------------

它可能在某种程度上与宏的定义有关。我不是glibc和其他东西的专家,对我来说,@MrFlick在评论中建议直接通过conda安装软件包(mamba install -c conda-forge r-ragg)

解决方案在日志中:

Configuration failed to find one of freetype2 libpng libtiff-4. Try installing:
* deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
* rpm: freetype-devel libpng-devel libtiff-devel libjpeg-turbo-devel (Fedora, CentOS, RHEL)
* csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)

安装这些包然后再试。

最新更新