2

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?

2
  • is there a module named OpenCV in your cluster? Apr 26, 2017 at 12:32
  • Thanks for your comment, yes there is but after loading it again I have the same issue,
    – S.EB
    Apr 27, 2017 at 11:08

2 Answers 2

2

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.

4
  • Thanks for your comment
    – S.EB
    Apr 28, 2017 at 2:21
  • Yes, still the same error. I think cv2 is not installed on cluster. Thanks for your help
    – S.EB
    Apr 30, 2017 at 0:39
  • No problem, if you need help getting cv2 on your cluster you can ask that as a separate question, but I think the conda package manger will help
    – Doryx
    May 1, 2017 at 16:01
  • 1
    Thank you very much once again\
    – S.EB
    May 1, 2017 at 17:10
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.