Closed vipcxj closed 3 months ago
Thanks for providing a detailed report.
I don't have a windows computer handy. Could you try to recreate the issue in a new environment where things from Nvidia and pytorch are not installed.
To troubleshoot. It is often good to find the cause of the problem.
It could be that they are installing some incompatible dll, or that our package is in fact broken. Either way, an environment with opencv and python only would really help troubleshoot
@hmaarrfk I recently reinstalled my python environment, so I also reinstalled opencv, the problem remains, I used centos7. Here is my reproduction steps:
mamba create -n my-env-name python=3.10
mamba install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
mamba install -c conda-forge torchinfo
mamba install -c conda-forge opencv
No error output. But when I run my python file, this error show:
module 'cv2' has no attribute 'Mat'
Of course, in the vscode, I can't jump to the source file by click the cv2 word.
This is my installed packages list at this moment:
I try to use conda instead of mamba, the problem still exists. But I can uninstall the opencv using conda and I can't uninstall the opencv using mamba. Here is the related link
Sorry i haven't been able to get back to you.
Generally speaking.....
mamba create -n my-env-name python=3.10
mamba install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
mamba install -c conda-forge torchinfo
mamba install -c conda-forge opencv
is pretty "unsupported" and definitely "unsupported" if the subject of the issue is "I think the package is broken".
The reason is that we are are basically incompatible with the default
channel, and to my knowlege, pytorch and nvidia aim to be compatible with the default
channel (from anaconda).
If the title was: "Improve compatibility with XXX channel" it would be a little different.
On our CIs, we tend to test with
mamba create -n my-env-name python=3.10 opencv --channel conda-forge --override-channels
If you can recreate your issue with that, then we can attempt to fix.
The general issue is that
all try to use hardware acceleration and the "newest" instruction sets. Their strategies differ in compatibility, especially when you install them from different channels (which different compatibility guarantees).
On linux, you can install pytorch from conda-forge, so maybe try that?
If the title was: "Improve compatibility with XXX channel" it would be a little different.
It would be a little different since my "assumption" would be that your knowledge of software integration would enable you to help craft a path toward this integration.
Generally speaking, i'm closing this as it is at the intersection of compatibility with the defaults channel, and this is not a workflow that we can tackle at a feedstock level.
If this is critical to your workflow, then please open a issue in a more central location conda-forge.github.io
is one place that is appropropriate
Solution to issue cannot be found in the documentation.
Issue
I install the opencv using mamba, and found I just install a empty package. I can import cv2 in vscode, but the package has nothing. It just a empty package. I use cv2.Mat, but python runtime tell me cv2 has no attribute Mat. I check the folder the opencv is installed. I think it should be 'opencv_python-4.7.0.dist-info'. There is two file in it. 'INSTALLER' and 'METADATA' Then I uninstall it and install opencv-python using pip. All works, and I found there are a lot of files in 'opencv_python-4.7.0.dist-info', And there is another folder named cv2 which not exist for conda package.
Installed packages
Environment info