ImportError with cv2 (opencv)
See original GitHub issueHi!
This something I noticed with Python 3.9 / pytest-6.2.2 / conda / Windows: while import cv2
works on Python, it causes an ImportError (dll not found) when testing my code with pytest.
I use various libraries like numpy, sklearn… and cv2 is the only one causing such error. It’s also the only one being installed as a single .pyd file put directly into the site-packages folder. The other one have their own folders.
import cv2
import sklearn
import numpy
print(cv2.__file__)
>>> C:\Users\francois\Miniconda3\envs\standard\lib\site-packages\cv2.cp39-win_amd64.pyd
print(sklearn.__file__)
>>> C:\Users\francois\Miniconda3\envs\standard\lib\site-packages\sklearn\__init__.py
print(numpy.__file__)
>>> C:\Users\francois\Miniconda3\envs\standard\lib\site-packages\numpy\__init__.py
Note that this problem does not exist on Linux (same Python 3.9 / pytest-6.2.2 / conda). In this case cv2 is also installed as a single file into the site-packages folder, but this time with a the .so extension.
Is there something I can to do fix it or at least give more useful information?
EDIT: added the code showing the difference between cv2 and sklearn/numpy.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
We might have to keep it open as to ensure pytest import strategy won’t break stuff
@Xsavaga25282 Did you read the comments in this thread?