安装R包infercnv时textshaping, ragg, gert依赖包安装报错

安装R包infercnv时报错 提示 textshaping, ragg, gert依赖包安装无法安装

具体每个包会有不同的报错,分别如下

textshaping包出现问题

trying URL 'https://cloud.r-project.org/src/contrib/textshaping_0.3.7.tar.gz'
Content type 'application/x-gzip' length 35100 bytes (34 KB)
==================================================
downloaded 34 KB

* installing *source* package ‘textshaping’ ...
** package ‘textshaping’ successfully unpacked and MD5 sums checked
** using staged installation
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lfreetype -lharfbuzz -lfribidi -lpng
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the harfbuzz freetype2 fribidi library. Try installing:
* deb: libharfbuzz-dev libfribidi-dev (Debian, Ubuntu, etc)
* rpm: harfbuzz-devel fribidi-devel (Fedora, EPEL)
* csw: libharfbuzz_dev libfribidi_dev (Solaris)
* brew: harfbuzz fribidi (OSX)
If harfbuzz freetype2 fribidi is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a harfbuzz freetype2 fribidi.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] ---------------------------
<stdin>:1:10: fatal error: hb-ft.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘textshaping’
* removing ‘/public/home/HeShuai/miniconda3/lib/R/library/textshaping’
* restoring previous ‘/public/home/HeShuai/miniconda3/lib/R/library/textshaping’

 -----------------------------------------------------------------------------------------------------

解决方法:

在centos7 中安装以下三个依赖包即可解决问题

yum install harfbuzz-devel fribidi-devel
yum install fontconfig-devel

请参考:https://github.com/r-lib/textshaping/issues/21

 


 ragg包出现问题

trying URL 'https://cloud.r-project.org/src/contrib/ragg_1.2.6.tar.gz'
Content type 'application/x-gzip' length 425391 bytes (415 KB)
==================================================
downloaded 415 KB

* installing *source* package ‘ragg’ ...
** package ‘ragg’ successfully unpacked and MD5 sums checked
** using staged installation
Package libtiff-4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libtiff-4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libtiff-4' found
Package libjpeg was not found in the pkg-config search path.
Perhaps you should add the directory containing `libjpeg.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libjpeg' found
Package libtiff-4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libtiff-4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libtiff-4' found
Package libjpeg was not found in the pkg-config search path.
Perhaps you should add the directory containing `libjpeg.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libjpeg' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lfreetype -lpng16 -ltiff -lz -ljpeg -lbz2
-----------------------------[ ANTICONF ]-------------------------------
Configuration failed to find one of freetype2 libpng libtiff-4 libjpeg. Try installing:
* deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
* rpm: freetype-devel libpng-devel libtiff-devel libjpeg-devel (Fedora, CentOS, RHEL)
* csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)
If freetype2 libpng libtiff-4 libjpeg is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a freetype2 libpng libtiff-4 libjpeg.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] ---------------------------
<stdin>:1:10: fatal error: ft2build.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘ragg’
* removing ‘/public/home/HeShuai/miniconda3/lib/R/library/ragg’
* restoring previous ‘/public/home/HeShuai/miniconda3/lib/R/library/ragg’

 -----------------------------------------------------------------

解决方法:

在centos7 中按照以下方法解决

安装以下依赖包

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).

安装完上述依赖包后仍然会有报错,继续安装 pkg-config即可解决问题

I saw the same error. The fix is to install pkg-config to the conda environment:
conda install -c conda-forge pkg-config
Somehow it seems that R c compiler under conda environment can not call system pkg-config correctly.

请参考:https://stackoverflow.com/questions/68824450/error-configuration-failed-for-package-ragg


 

gert包出现问题

** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘gert’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/public/home/HeShuai/miniconda3/lib/R/library/00LOCK-gert/00new/gert/libs/gert.so':
/public/home/HeShuai/miniconda3/lib/R/library/00LOCK-gert/00new/gert/libs/gert.so: undefined symbol: getentropy
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/public/home/HeShuai/miniconda3/lib/R/library/gert’

----------------------------------------------

解决方法:

In particular, I am using Miniconda, ubuntu enviorment. Centos7通用适用。

After installing libgit2 using conda install -c conda-forge libgit2 and set Sys.setenv( USE_SYSTEM_LIBGIT2 = 1 ) in R.

My problem is resolved.

请参考:https://github.com/r-lib/gert/issues/157

 

posted @ 2023-11-09 22:37  何帅  阅读(1611)  评论(0编辑  收藏  举报