You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If both versions of opencv are installed in an environment, uninstalling one version shouldn't mess with the other version.
Yes, I'm very aware that you are not supposed to download both versions. And the readme does state If you installed multiple different packages in the same environment, uninstall them all with pip uninstall and reinstall only one package. But if it would be possible to skip uninstalling all versions it would be very useful.
I'm in the same situation as this comment. When users download our package with pip install ourpackage, pip downloads dependency A, which has opencv-python as a dependency, and dependency B, which has opencv-contrib-python as a dependency. As far as I can tell, there is no way to prevent these downloads from pip. Our goal is to make installing our package as easy as possible, and adding multiple pip steps of uninstalling and reinstalling is intimidating for non-technical users. It also takes up support time for us, since users will inevitably try to uninstall only one package. Resolving this installation issue would be very helpful in reducing the install instructions for packages which cannot avoid this opencv conflict.
Actual behaviour
Uninstalling opencv-python when opencv-contrib-python is installed prevents opencv-contrib-python from working properly. For example, import cv2, cv2.VideoCapture(0) errors with AttributeError: module 'cv2' has no attribute 'VideoCapture'.
I initially thought both packages shared the cv2 folder in site-packages and uninstalling one deleted that folder, but that appears not to be the case. (EDIT) The contents of the folder do change quite a bit though. In a new conda environment with both opencv versions installed:
$ ls $CONDA_PREFIX/lib/python3.11/site-packages
README.txt
_distutils_hack
cv2 ### Both dist-info folders seem to reference this
distutils-precedence.pth
numpy
numpy-1.26.4.dist-info
opencv_contrib_python-4.9.0.80.dist-info
opencv_python-4.9.0.80.dist-info
pip
pip-23.3.1-py3.11.egg-info
pkg_resources
setuptools
setuptools-68.2.2-py3.11.egg-info
wheel
wheel-0.41.2.dist-info
$ ls $CONDA_PREFIX/lib/python3.11/site-packages/cv2
Error flann phase_unwrapping
LICENSE-3RD-PARTY.txt ft plot
LICENSE.txt gapi ppf_match_3d
__init__.py hfs py.typed
__init__.pyi img_hash quality
__pycache__ intensity_transform rapid
aruco ipp reg
barcode kinfu rgbd
bgsegm large_kinfu saliency
bioinspired legacy samples
ccm line_descriptor segmentation
colored_kinfu linemod stereo
config-3.py load_config_py2.py structured_light
config.py load_config_py3.py text
cuda mat_wrapper typing
cv2.abi3.so mcc utils
data misc version.py
datasets ml videoio_registry
detail motempl videostab
dnn multicalib wechat_qrcode
dnn_superres ocl xfeatures2d
dpm ogl ximgproc
dynafu omnidir xphoto
face optflow
fisheye parallel
After running pip uninstall opencv-python:
$ ls $CONDA_PREFIX/lib/python3.11/site-packages
README.txt
_distutils_hack
cv2 ### but it isn't removed when uninstalling one version
distutils-precedence.pth
numpy
numpy-1.26.4.dist-info
opencv_contrib_python-4.9.0.80.dist-info
pip
pip-23.3.1-py3.11.egg-info
pkg_resources
setuptools
setuptools-68.2.2-py3.11.egg-info
wheel
wheel-0.41.2.dist-info
$ ls $CONDA_PREFIX/lib/python3.11/site-packages/cv2
bgsegm kinfu quality
bioinspired large_kinfu rapid
ccm legacy reg
colored_kinfu line_descriptor rgbd
datasets linemod saliency
dnn_superres mcc stereo
dpm motempl structured_light
dynafu multicalib text
face omnidir videostab
ft optflow wechat_qrcode
hfs phase_unwrapping xfeatures2d
img_hash plot ximgproc
intensity_transform ppf_match_3d xphoto
Diff between the two versions of the cv2 folder, sorted (diff old new):
This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
I'm using the latest version of opencv-python
The text was updated successfully, but these errors were encountered:
Expected behaviour
If both versions of opencv are installed in an environment, uninstalling one version shouldn't mess with the other version.
Yes, I'm very aware that you are not supposed to download both versions. And the readme does state
If you installed multiple different packages in the same environment, uninstall them all with pip uninstall and reinstall only one package
. But if it would be possible to skip uninstalling all versions it would be very useful.I'm in the same situation as this comment. When users download our package with
pip install ourpackage
, pip downloads dependency A, which has opencv-python as a dependency, and dependency B, which has opencv-contrib-python as a dependency. As far as I can tell, there is no way to prevent these downloads from pip. Our goal is to make installing our package as easy as possible, and adding multiple pip steps of uninstalling and reinstalling is intimidating for non-technical users. It also takes up support time for us, since users will inevitably try to uninstall only one package. Resolving this installation issue would be very helpful in reducing the install instructions for packages which cannot avoid this opencv conflict.Actual behaviour
Uninstalling opencv-python when opencv-contrib-python is installed prevents opencv-contrib-python from working properly. For example,
import cv2, cv2.VideoCapture(0)
errors withAttributeError: module 'cv2' has no attribute 'VideoCapture'
.Steps to reproduce
I initially thought both packages shared the cv2 folder in site-packages and uninstalling one deleted that folder, but that appears not to be the case. (EDIT) The contents of the folder do change quite a bit though. In a new conda environment with both opencv versions installed:
After running
pip uninstall opencv-python
:Diff between the two versions of the cv2 folder, sorted (diff old new):
Mac Monterrey 12.6.2
Arm64
opencv_python-4.9.0.80
Issue submission checklist
opencv-python
The text was updated successfully, but these errors were encountered: