You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

集群中Snakemake调用R加载ggplot2失败的技术求助

问题:Snakemake调用R绘图时rlang加载失败

我使用Snakemake调用R进行生物信息分析,在集群执行流程的最后一步生成绘图时出现报错,核心问题是rlang库的共享对象加载失败,提示undefined symbol: R_NewEnv。

Snakemake规则代码

rule plot_macs_qc:
    input:
        get_called_peaks
    output:
        summary="results/peak_calling/plots/plot_{peak_profile}_peaks_summary.txt",
        plot="results/peak_calling/plots/plot_{peak_profile}_peaks.pdf"
    log:
        "logs/plot_macs_qc/plot_{peak_profile}_peaks.log"
    params:
        peak_files=lambda wc, input: ",".join(input),
        sample_ids=",".join(get_sample_control_combinations())
    conda:
        "../envs/peak_qc.yaml"
    shell:
        f"Rscript {workflow.basedir}/scripts/plot_macs_qc.R "
        f"-i {{params.peak_files}} "
        f"-s {{params.sample_ids}} "
        f"-o {{output.plot}} "
        f"-p {{output.summary}} 2> {{log}}"

报错信息

Warning message:
package ‘optparse’ was built under R version 4.0.5 
Error: package or namespace load failed for ‘ggplot2’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/omics/odcf/analysis/OE0538_projects_temp/DO-0009/yoav/R/Libs/rlang/libs/rlang.so':
  /omics/odcf/analysis/OE0538_projects_temp/DO-0009/yoav/R/Libs/rlang/libs/rlang.so: undefined symbol: R_NewEnv
In addition: Warning message:
package ‘ggplot2’ was built under R version 4.4.0 
Execution halted

已尝试解决步骤

  • 删除rlang所在文件夹及缓存后重新安装rlang
  • 确保rlang和ggplot2针对正确的R版本(4.4.0)编译,并位于正确的库路径中
  • 无集群根权限,无法修改系统级设置

R会话信息

> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.3.so;  LAPACK version 3.8.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C        

time zone: Europe/Berlin
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_3.5.1 rlang_1.1.4  

loaded via a namespace (and not attached):
 [1] utf8_1.2.4        R6_2.5.1          tidyselect_1.2.1  magrittr_2.0.3    gtable_0.3.6      glue_1.8.0       
 [7] tibble_3.2.1      pkgconfig_2.0.3   generics_0.1.3    dplyr_1.1.4       lifecycle_1.0.4   cli_3.6.3        
[13] fansi_1.0.6       scales_1.3.0      grid_4.4.0        vctrs_0.6.5       withr_3.0.2       compiler_4.4.0   
[19] rstudioapi_0.16.0 tools_4.4.0       munsell_0.5.1     pillar_1.9.0      colorspace_2.1-1 

内容的提问来源于stack exchange,提问作者yoav

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 03:35:53