简体   繁体   中英

How to import cv2 in slurm?

I have a python program that I am running on slurm. My python program is importing different packages. When I am trying to import cv2 , I am facing the following error:

import cv2
ImportError: No module named 'cv2'

My job script is:

#!/bin/bash
#SBATCH --job-name=myjob
#SBATCH --account=default
#SBATCH --time=2-00:00:00
#SBATCH --ntasks=4
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=1
#SBATCH --gres=gpu:1
#SBATCH --partition=m3c
#SBATCH --mem=4000
module load python/3.5.2-gcc4
module load cuda/8.0
module load cudnn/5.1
module load hdf5/1.10.0-patch1
module list
python3 /path/to/pythonscript/mycode.py

How can I tackle this issue on slurm ?

First, make sure that this is a slurm issue by checking to see if the cv2 can be imported outside of a job submission.

module load python/3.5.2-gcc4
module load cuda/8.0
module load cudnn/5.1
module load hdf5/1.10.0-patch1
python3 -c 'import cv2'

And see if you get an error.

Try using this: module load OpenCV

If it still fails then check if OpenCV is installed in the cluster by running module spider in the terminal. This command will list all the available modules in the cluster.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM