当前位置:   article > 正文

Centos7_miniconda_devtools安装_R语言入门之R包的安装_in install.packages("devtools") : 安装程序包‘systemfont

in install.packages("devtools") : 安装程序包‘systemfonts’时退出狀態的值不

因为有同事反馈安装R包很慢或卡住,提供了一个安装R包的命令给我测试,在安装过程中复现报错信息,把下载慢或卡顿的链接中的域名在防火墙中调整出口。

devtools::install_github("GreenleafLab/ArchR", ref="master", repos = BiocManager::repositories())

下载安装miniconda

  1. wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
  2. chmod +x Miniconda3-latest-Linux-x86_64.sh #给下载下来的安装文件添加执行权限
  3. sudo bash Miniconda3-latest-Linux-x86_64.sh

一路Enter----yes—yes直到安装完成
进入conda环境

  1. source ~/.bashrc
  2. conda

国内换源

  1. #全部清华园,备用
  2. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/MindSpore
  3. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle
  4. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/auto
  5. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/biobakery
  6. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
  7. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/c4aarch64
  8. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/caffe2
  9. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  10. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/deepmodeling
  11. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/dglteam
  12. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai
  13. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fermi
  14. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/idaholab
  15. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/intel
  16. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/matsci
  17. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
  18. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/mordred-descriptor
  19. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
  20. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/numba
  21. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/ohmeta
  22. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/omnia
  23. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123
  24. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/plotly
  25. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/psi4
  26. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
  27. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch-lts
  28. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch-test
  29. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch3d
  30. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pyviz
  31. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/qiime2
  32. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/rapidsai
  33. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/rdkit
  34. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/simpleitk
  35. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/stackless
  36. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/ursky

 安装下R语言运行环境,安装R4.0.0(开始时安装R4.3.1提示不支持某个插件,具体不记得了)

conda search R

 创建R4.0环境

conda create -n r4.0

进入R4.0环境 

conda activate r4.0

安装R4.0

conda install R=4.0 -y

 

进入R程序 

 

安装devtools

install.packages("devtools")

 安装R包报错:

1) grab failed: window not viewable.

  1. Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : 
  2. [tcl] grab failed: window not viewable.

一般发生在远程linux系统中安装R包,是因为R调用窗口失败,解决方法是

chooseCRANmirror(graphics=FALSE)

输入16回车,再运行一次安装命令。

install.packages("devtools")

 可能还会有下面出错信息

  1. 1: In install.packages("devtools", dependencies = TRUE) :
  2. 安装程序包‘systemfonts’时退出狀態的值不是0
  3. 2: In install.packages("devtools", dependencies = TRUE) :
  4. 安装程序包‘textshaping’时退出狀態的值不是0
  5. 3: In install.packages("devtools", dependencies = TRUE) :
  6. 安装程序包‘ragg’时退出狀態的值不是0
  7. 4: In install.packages("devtools", dependencies = TRUE) :
  8. 安装程序包‘pkgdown’时退出狀態的值不是0
  9. 5: In install.packages("devtools", dependencies = TRUE) :
  10. 安装程序包‘devtools’时退出狀態的值不是0

解决办法: 

 1.install.packages('fontconfig')根据报错提示安装

    yum install fontconfig-devel
   
 2.install.packages('textshaping')根据报错提示安装

   yum install -y  harfbuzz-devel fribidi-devel
   
 3.install.packages('ragg')根据报错提示安装

yum install -y freetype-devel libpng-devel libtiff-devel libjpeg-devel

 4.处理完1.2.3再安装下面包已经不再提示错误了。
 install.packages('pkgdown')

处理完再试试安装devtools.

在R中使用devtools安装R

devtools::install_github("GreenleafLab/ArchR", ref="master", repos = BiocManager::repositories())

 例如生信分析常用到的Bioconductor,可使用BiocManager::install()来进行安装,例如安装DESeq2包

  1. if (!require("BiocManager", quietly = TRUE))
  2. install.packages("BiocManager")
  3. BiocManager::install("DESeq2")

又报出错。

ERROR: dependencies ‘SummarizedExperiment’, ‘rhdf5’, ‘motifmatchr’, ‘chromVAR’, ‘uwot’, ‘Rsamtools’, ‘Biostrings’, ‘ComplexHeatmap’, ‘GenomicRanges’ are not available for package ‘ArchR’
* removing ‘/root/miniconda3/envs/r4.0/lib/R/library/ArchR’

使用pacman包来批量安装依赖包

install.packages("pacman")

使用p_install函数,并通过packages参数传入要安装的包名列表:

pacman::p_install(packages = c("SummarizedExperiment", "rhdf5", "motifmatchr", "chromVAR", "uwot", "Rsamtools", "Biostrings", "ComplexHeatmap", "GenomicRanges"))

出现ERROR: dependency ‘locfit’ is not available for package ‘DESeq2’ 的报错。此时往往是由于默认安装的locfit版本的问题导致的,所以通过指定低一点的版本(例如1.5-9.2)即可安装。

install.packages('https://cran.r-project.org/src/contrib/Archive/locfit/locfit_1.5-9.2.tar.gz',repos = NULL)

出错揭示:

  1. checking for gcc... no
  2. checking for cc... no
  3. checking for cl.exe... no
  4. checking for clang... no
  5. configure: error: in `/tmp/RtmpuOjLUv/R.INSTALLe06dd4f1f4256/XML':
  6. configure: error: no acceptable C compiler found in $PATH
  7. See `config.log' for more details
  8. ERROR: configuration failed for package ‘XML’
  9. * removing ‘/root/miniconda3/envs/r4.0/lib/R/library/XML’
  10. * installing *source* package ‘BiocParallel’ ...
  11. ** using staged installation
  12. checking for gcc... no
  13. checking for cc... no
  14. checking for cl.exe... no
  15. configure: error: in `/tmp/RtmpsFlbCG/R.INSTALLe075b1e0ffb7b/BiocParallel':
  16. configure: error: no acceptable C compiler found in $PATH
  17. See `config.log' for more details

由于本机缺少gcc编译环境,通过yum安装gcc编译环境:

yum install -y gcc

再次运行安装,提示出错信息如下

  1. * DONE (BiocParallel)
  2. ERROR: dependency ‘XML’ is not available for package ‘annotate’
  3. * removing ‘/root/miniconda3/envs/r4.0/lib/R/library/annotate’
  4. ERROR: dependency ‘annotate’ is not available for package ‘genefilter’
  5. * removing ‘/root/miniconda3/envs/r4.0/lib/R/library/genefilter’
  6. ERROR: dependency ‘annotate’ is not available for package ‘geneplotter’
  7. * removing ‘/root/miniconda3/envs/r4.0/lib/R/library/geneplotter’
  8. ERROR: dependencies ‘genefilter’, ‘geneplotter’ are not available for package ‘DESeq2
  9. * removing ‘/root/miniconda3/envs/r4.0/lib/R/library/DESeq2

 安装xml

install.packages('XML')

提示出错:

  1. You are trying to use a version 2.* edition of libxml
  2. but an incompatible library. The header files and library seem to be
  3. mismatched. If you have specified LIBXML_INCDIR, make certain to also
  4. specify an appropriate LIBXML_LIBDIR if the libxml2 library is not in the default
  5. directories.
  6. ERROR: configuration failed for package ‘XML’
  7. * removing ‘/root/miniconda3/envs/r4.0/lib/R/library/XML’
  8. 下载的程序包在
  9. /tmp/Rtmp6sGhlh/downloaded_packages’里
  10. 更新'.Library'里的HTML程序包列表
  11. Making 'packages.html' ... 做完了。
  12. Warning message:
  13. In install.packages("XML") : 安装程序包‘XML’时退出狀態的值不是0

进入R,

>Sys.setenv(XML_CONFIG="/usr/bin/xml2-config") #指定安装时libxml2的目录

>install.packages("XML")

xml安装完成。

再运行一次

  1. if (!require("BiocManager", quietly = TRUE))
  2. install.packages("BiocManager")
  3. BiocManager::install("DESeq2")

全部安装成功。

参考文章:Miniconda3环境配置,换国内源_miniconda换源-CSDN博客

参考文章:没有人比我更懂R包安装 - 知乎 

参考文章:DEseq2和edgeR的安装问题记录_deseq2安装报错-CSDN博客

参考文章:https://www.cnblogs.com/shuaihe/p/11379361.html 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/624623
推荐阅读
相关标签
  

闽ICP备14008679号