最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

slurm - How can I specify for R to look in one directory for the dependencies of a package installed in another? - Stack Overflo

programmeradmin2浏览0评论

I'm trying to make R scripts run on a HPC cluster (with SLURM workload manager), which need a specific package that I installed in a personal directory since I can't install packages in the server-wide R installation. I tried to use .libPaths() and exporting a R_LIBS_USER variable in my bash scripts, but I can't get it to work. Here's my bash script generating the R scripts that i want to use. I always get the error that my package (EasyQC) cannot find its dependencies (the first being Cairo, which stops it immediately). Sorry for this post being a bit confused, I've been fighting with this for 2 days now and it's driving me a little mad. Thanks for your attention !

# Create R script to submit

cat > $HOME/output/easyQ/${input}_cleaning.R <<EOF

#!/usr/bin/env Rscript
HOME='$HOME'
source(paste0(HOME, "/analysis/input.R"))

.libPaths(R_LIBS_USER)
print(.libPaths())
library(EasyQC)
print("EasyQC loaded")

EasyQC(paste0(HOME, "/output/easyQ/${input}_cleaning.ecf"))

EOF


# Submit R script

echo "submit ${input}"

cat > $HOME/output/easyQ/${input}_cleaning.sh <<EOF
#!/bin/bash

#SBATCH --time=32:00:00 
#SBATCH --mem=16G
#SBATCH --job-name=$input
#SBATCH --cpus-per-task=1
#SBATCH --chdir=$HOME/output/easyQ
#SBATCH --output=$HOME/output/log/%x.out
#SBATCH --error=$HOME/output/log/%x.err


# Load packages
module purge
module load r-light

export R_LIBS_USER=Path1:Path2

Rscript --no-save $HOME/output/easyQ/${input}_cleaning.R > $HOME/output/easyQ/${input}_cleaning_batch.log

EOF

I tried to use the .libPaths() function as well as lib.loc=Path when loading the libraries, but I cant really figure out how to use them.

I finallly fixed this by just loading another R moduel, with no real idea of how it worked.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论