安装monocle3记录

monocle2版本已经弃用,决定安装monocle3,但按照官网流程安装很困难。博主花了一晚上时间终于在两个服务器中安装成功。

基础安装代码(copy自官网 Monocle 3

conda create -n monocle3
conda activate monocle3
conda install -c conda-forge r-base=4.3.3
which R

进入R环境:

if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.14")


BiocManager::install(c('BiocGenerics', 'DelayedArray', 'DelayedMatrixStats',
                       'limma', 'lme4', 'S4Vectors', 'SingleCellExperiment',
                       'SummarizedExperiment', 'batchelor', 'HDF5Array',
                       'terra', 'ggrastr'))


install.packages("devtools")
devtools::install_github('cole-trapnell-lab/monocle3')

无法用install.packages()安装的包tips:

# 使用conda-forge自动解决依赖问题

conda install -c conda-forge r-<包名>

# 下载包到本地安装

install.packages("./ggrastr_1.0.2.tar.gz", repos = NULL, type = "source")

常见bug:

1. ERROR: dependency ‘Matrix’ is not available for package ‘BiocNeighbors’

解决方法:CRAN下载低版本并本地安装

install.packages("./Matrix_1.5-3.tar.gz", repos = NULL, type = "source")

2. 编译 systemfonts 包时缺少 fontconfigfreetype2 依赖库

Package fontconfig was not found in the pkg-config search path. Perhaps you should add the directory containing fontconfig.pc' to the PKG_CONFIG_PATH environment variable No package 'fontconfig' found 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=-lfontconfig -lfreetype

conda install -c conda-forge fontconfig freetype

find $CONDA_PREFIX -name "fontconfig.pc"
find $CONDA_PREFIX -name "freetype2.pc"

export PKG_CONFIG_PATH=$CONDA_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH

 进入R环境设置

Sys.setenv(PKG_CONFIG_PATH = paste0(Sys.getenv("CONDA_PREFIX"), "/lib/pkgconfig:", Sys.getenv("PKG_CONFIG_PATH")))
install.packages("systemfonts")

3. 系统中缺少 libxml2 库导致的,它是 xml2 包安装的必要依赖

Package libxml-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing libxml-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libxml-2.0' found Package libxml-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing libxml-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libxml-2.0' found Using PKG_CFLAGS= Using PKG_LIBS=-lxml2

conda install -c conda-forge libxml2
export PKG_CONFIG_PATH="$CONDA_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
install.packages("xml2")

4. 其他小问题,大部分用conda-forge 就能解决

conda install -c conda-forge r-devtools
conda install -c conda-forge r-lme4 r-sf r-spdep
conda install -c conda-forge cmake
conda install -c conda-forge r-nloptr
conda install -c conda-forge udunits2

见招拆招即可。 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值