ModuleNotFoundError: No module named 'cv2' in jupyter notebook

Posted Over 3 years ago. Visible to the public.

Create a new environment with as of now python 3.7 since opencv not available in conda's python 3.8 packages

conda create --name opencv-cuda python=3.7
conda activate opencv-cuda
conda install pytorch torchvision cudatoolkit=10.2 opencv -c pytorch
python
import cv2

If the above is all fine, but in jupyter the "No module named 'cv2'" error still an issue. Make sure to install jupyter in that environment too.

If jupyter is intalled in the base environment but not in opencv-cud it will be started but since "base" env doesn't contain opencv.

Environment hierarchy:
base
|- opencv-cuda

Make sure jupyter is intalled in the current environment eg: opencv-cuda

conda install jupyter
Bonyiii
Last edit
Over 3 years ago
Bonyiii
Posted by Bonyiii to Bonyiii's deck (2020-09-05 20:46)