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
Dependencies in requirements.txt have module conflicts.
Description
There are two dependencies mentioned in the requirements.txt file: opencv-python and opencv-contrib-python. The official spec mentioned that the opencv-python package includes the main modules, while opencv-contrib-python contains both the main modules and additional contrib/extra modules. The documentation also states that these two packages cannot be installed simultaneously (the exact wording is: “There are four different packages (see options 1, 2, 3, and 4 below) and you should SELECT ONLY ONE OF THEM.”). This is because they both use the same module name cv2.
During the installation process using pip, the package installed later will override the cv2 module from the previously installed package (specifically, the modules within the cv2 folders that exist in both packages). Furthermore, the requirements.txt file even includes different versions of these two packages. It is certain that the common files with the same path in these two packages contain different contents. Therefore, there may be functional implications when using them. However, without analyzing the specific code and function call hierarchy of this project, it can be stated that issues related to overwriting and module conflicts do exist.
Steps to Reproduce
pip install -r requirements.txt
Desired Change
Indeed, it is not an ideal behavior for modules to be overwritten, even if they are not actively used or if the overwritten module is the one being called. It introduces uncertainty and can cause issues in the long run, especially if there are changes or updates to the overwritten modules in future development. It is generally recommended to avoid such conflicts and ensure that only the necessary and compatible dependencies are declared in the requirements to maintain a stable and predictable environment for the project.
We believe that although this project can only modify direct dependencies and indirect dependencies are a black box, it is possible to add additional explanations rather than directly declaring both conflicting packages in the requirements.txt file.
Adding extra explanations or documentation about the potential conflicts and the need to choose only one of the conflicting packages can help developers understand the issue and make informed decisions. Including a clear instruction or warning in the project’s documentation can guide users to choose the appropriate package based on their specific requirements.
The text was updated successfully, but these errors were encountered:
I included opencv-contrib-python in the requirements because I faced an issue with opencv on Ubuntu that I was only able to fix by installing it. I will keep this issue open until we test dot using only opencv-contrib-python.
I included opencv-contrib-python in the requirements because I faced an issue with opencv on Ubuntu that I was only able to fix by installing it. I will keep this issue open until we test dot using only opencv-contrib-python.
Thank you for your reply, I don't have a particularly good solution at the moment as indirect dependencies are out of your control.
Or you can try to remove all opencv related packages (opencv-python, opencv-python-headless, opencv-contrib-python, opencv-contrib-python-headless) after installing all the dependencies, and then re-install just the opencv-contrib-python.
Background
Dependencies in
requirements.txt
have module conflicts.Description
There are two dependencies mentioned in the
requirements.txt
file:opencv-python
andopencv-contrib-python
. The official spec mentioned that theopencv-python
package includes the main modules, whileopencv-contrib-python
contains both the main modules and additional contrib/extra modules. The documentation also states that these two packages cannot be installed simultaneously (the exact wording is: “There are four different packages (see options 1, 2, 3, and 4 below) and you should SELECT ONLY ONE OF THEM.”). This is because they both use the same module name cv2.During the installation process using pip, the package installed later will override the cv2 module from the previously installed package (specifically, the modules within the cv2 folders that exist in both packages). Furthermore, the
requirements.txt
file even includes different versions of these two packages. It is certain that the common files with the same path in these two packages contain different contents. Therefore, there may be functional implications when using them. However, without analyzing the specific code and function call hierarchy of this project, it can be stated that issues related to overwriting and module conflicts do exist.Steps to Reproduce
pip install -r requirements.txt
Desired Change
Indeed, it is not an ideal behavior for modules to be overwritten, even if they are not actively used or if the overwritten module is the one being called. It introduces uncertainty and can cause issues in the long run, especially if there are changes or updates to the overwritten modules in future development. It is generally recommended to avoid such conflicts and ensure that only the necessary and compatible dependencies are declared in the requirements to maintain a stable and predictable environment for the project.
We believe that although this project can only modify direct dependencies and indirect dependencies are a black box, it is possible to add additional explanations rather than directly declaring both conflicting packages in the requirements.txt file.
Adding extra explanations or documentation about the potential conflicts and the need to choose only one of the conflicting packages can help developers understand the issue and make informed decisions. Including a clear instruction or warning in the project’s documentation can guide users to choose the appropriate package based on their specific requirements.
The text was updated successfully, but these errors were encountered: