美文网首页
linux环境下安装R语言

linux环境下安装R语言

作者: expgene | 来源:发表于2023-09-28 11:47 被阅读0次

    探序基因肿瘤研究院整理

    下载R的源代码:

    https://cloud.r-project.org

    建议使用的参数:

    --enable-R-shlib最好开启,否则libR.so将不会生成,而很多程序依赖本这个库。

    tcktk问题:

    sudo apt-get install tcl-dev,sudo apt-get install tk-dev

    yum install tcl tcl-devel tk,tk-devel

    为了解决后面使用Rstudio X11无法画图问题,建议yum install cairo-devel来安装cairo的库。后续通过Rstudio的global options里面的页面,设置用cairo来显示图形。

    R编译和安装命令:

    sudo ./configure --enable-R-shlib --with-x --with-tcltk CFLAGS="-fPIC" CXXFLAGS="-fPIC"

    或者./configure --enable-R-shlib --with-x --with-tcltk

    ./configure --enable-R-shlib --with-x --with-tcltk --with-libtiff --with-libpng --with-jpeglib --with-x --with-cairo --with-pcre1 --with-tiff --with-jpeg

    ./configure --enable-R-shlib --with-x --with-tcltk --with-libtiff --with-libpng --with-jpeglib --with-cairo --with-pcre1 --with-tiff --with-jpeg --with-blas --with-lapack --with-readline

    make

    make install

    安装完后的总结:

    R is now configured for x86_64-pc-linux-gnu

      Source directory:            .

      Installation directory:      /usr/local

      C compiler:                  gcc  -g -O2

      Fortran fixed-form compiler: gfortran  -g -O2

      Default C++ compiler:        g++ -std=gnu++17  -g -O2

      C++11 compiler:              g++ -std=gnu++11  -g -O2

      C++14 compiler:              g++ -std=gnu++14  -g -O2

      C++17 compiler:              g++ -std=gnu++17  -g -O2

      C++20 compiler:               

      C++23 compiler:               

      Fortran free-form compiler:  gfortran  -g -O2

      Obj-C compiler:        

      Interfaces supported:        X11, tcltk

      External libraries:          pcre2, readline, curl

      Additional capabilities:    PNG, NLS

      Options enabled:            shared R library, shared BLAS, R profiling

      Capabilities skipped:        JPEG, TIFF, cairo, ICU

      Options not enabled:        memory profiling

      Recommended packages:        yes

    configure: WARNING: you cannot build info or HTML versions of the R manuals

    configure: WARNING: you cannot build PDF versions of the R manuals

    configure: WARNING: you cannot build PDF versions of vignettes and help pages

    X11图形显示的问题:

    这个比较容易有问题。暂时未找到好的解决方法

    其他由于缺少依赖的而需要安装的:

    No Fortran compiler found:

    yum install gcc-gfortran

    error: --with-readline=yes (default) and headers/libs are not available:

    yum install readline-devel

    error: --with-x=yes (default) and X11 headers/libs are not available:

    yum install libXt-devel

    configure: error: libcurl >= 7.28.0 library and headers are required with support for https:yum install libcurl-devel(注意看版本)

    #include <jni.h>

    编译中断。

    make[2]: *** [/home/dongxj/R-4.3.2/etc/Makeconf:191:conftest.o] 错误 1

    make[2]: 离开目录“/tmp/Rjavareconf.fSHbh4”

    Unable to compile a JNI program:

    yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel

    checking for BZ2_bzlibVersion in -lbz2... no

    checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required:

    yum install bzip2-devel

    其他推荐的系统基础库安装:(centos stream)

    yum install libxml2-devel

    yum install harfbuzz-devel

    yum install fribidi-devel

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

    单细胞分析常用R包安装:

    harmony:

    install.packages("harmony")

    infercnv:

    先安装lapack和blas:
    https://www.netlib.org/lapack/#_lapack_version_3_10_0

    http://www.netlib.org/blas/

    安装的时候,遇到问题:

    /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../liblapack.a(dlarf.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

    /usr/bin/ld: //usr/local/lib/libblas.a(dgemv.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

    可能是R安装时,配置时没有加--with-blas和--with-lapack的参数?gcc版本太低?

    于是yum install lapack,后重新编译了R。也不行。

    使用新的gcc,版本

    https://blog.csdn.net/qq_37329349/article/details/82385012

    https://www.jianshu.com/p/d5a03fca267e

    https://www.cnblogs.com/snake553/p/7151787.html

    安装JAGS遇到的问题:(centos8,gcc8.5.0)

    checking for Fortran 77 libraries of gfortran... (cached) -L/usr/lib/gcc/x86_64-redhat-linux/8 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/8/../../.. -lgfortran -lm -lquadmath

    checking for sgemm_ in /usr/lib64... no

    checking if sgemm_ is being linked in already... no

    checking for ATL_xerbla in -latlas... no

    checking for sgemm_ in -lblas... no

    checking for sgemm_ in -lmkl... no

    checking for sgemm_ in -framework vecLib... no

    checking for sgemm_ in -lcxml... no

    checking for sgemm_ in -ldxml... no

    checking for sgemm_ in -lscs... no

    checking for sgemm_ in -lcomplib.sgimath... no

    checking for sgemm_ in -lblas... (cached) no

    checking for sgemm_ in -lblas... (cached) no

    configure: error: "You need to install the LAPACK library"

    可是明明已经yum install lapack。他搜索KAPACK库的地址应该是在gcc里的。

    GSVA:

    BiocManager::install("GSVA")

    GSEABase:

    BiocManager::install("GSEABase")

    msigdbr:

    BiocManager::install("msigdbr")

    COSG:

    remotes::install_github(repo = 'genecell/COSGR')

    https://cloud.tencent.com/developer/article/2320105

    dittoSeq:

    BiocManager::install("dittoSeq")

    VISION:

    yum install libsodium-devel

    BiocManager::install("VISION")

    harmony:

    library("devtools")

    install_github("immunogenomics/harmony")

    SCENIC:

    需要安装GENIE3’, ‘RcisTarget’, ‘AUCell

    BiocManager::install("AUCell")

    BiocManager::install("GENIE3")

    devtools::install_github("aertslab/RcisTarget")

    devtools::install_github("aertslab/SCENIC")

    Cellchat:

    要安装ComplexHeatmap’, ‘BiocNeighbors

    BiocManager::install("ComplexHeatmap")

    BiocManager::install("BiocNeighbors")

    devtools::install_github("sqjin/CellChat")

    scMetabolism:

    wget https://cloud.r-project.org/src/contrib/magick_2.8.3.tar.gz

    devtools::install_github("wu-yc/scMetabolism")

    scRNAtoolVis:

    yum install ImageMagick-c++-devel

    wget https://cloud.r-project.org/src/contrib/magick_2.8.3.tar.gz(注意下载地址可能会变动,到时到https://cloud.r-project.org/src/contrib搜索magick的最新地址)

    R CMD INSTALL magick_2.8.3.tar.gz

    devtools::install_github('junjunlab/scRNAtoolVis')

    monocle2:

    BiocManager::install(c("leidenbase","viridis","biocViews","RANN"))

    BiocManager::install("monocle")

    参考:https://zhuanlan.zhihu.com/p/669186759,https://www.jianshu.com/p/e7c02697e015

    monocle3:

    yum install udunits2-devel

    参考:https://www.jianshu.com/p/78eeae93c5a0

    相关文章

      网友评论

          本文标题:linux环境下安装R语言

          本文链接:https://www.haomeiwen.com/subject/abslbdtx.html