cv2 import error in docker image projectmonai/monailabel:0.4.0
See original GitHub issueDescribe the bug
MONAI-Label Server cannot be executed in the current version of the monailabel docker container, because of an opencv
import error.
To Reproduce
- Run docker container, tag 0.4.0, e.g. via:
docker run -it --gpus all --network=host projectmonai/monailabel:0.4.0 bash
- Run:
python -c "import cv2"
Error message This throws the following error message:
root@workstation:/opt/monai# python -c "import cv2"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/conda/lib/python3.8/site-packages/cv2/__init__.py", line 181, in <module>
bootstrap()
File "/opt/conda/lib/python3.8/site-packages/cv2/__init__.py", line 175, in bootstrap
if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
File "/opt/conda/lib/python3.8/site-packages/cv2/__init__.py", line 28, in __load_extra_py_code_for_module
py_module = importlib.import_module(module_name)
File "/opt/conda/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/opt/conda/lib/python3.8/site-packages/cv2/mat_wrapper/__init__.py", line 33, in <module>
cv._registerMatType(Mat)
AttributeError: partially initialized module 'cv2' has no attribute '_registerMatType' (most likely due to a circular import)
Environment
As described above, I am using OOTB docker container projectmonai/monailabel:0.4.0
.
Additional information
For context, this error does not occur in the current monai-core docker image: projectmonai/monai:0.9.0
.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Error in Running Docker image. Showing no module named ...
I am not able to run my script on docker as I am not able to run modules like cv2 , numpy ,...
Read more >OpenCV Docker error "ImportError: libSM.so.6: cannot open ...
I am trying to run my deep learning model on docker. I am using OpenCV for some initial image processing. The problem is...
Read more >cannot import OpenCV in a Docker container in Raspberry Pi
Seems to be just an issue with a Python package. Traceback (most recent call last): File "a.py", line 1, in <module> import cv2...
Read more >GitLab Docker images
The GitLab Docker images are monolithic images of GitLab running all the necessary services in a single container. If you instead want to...
Read more >Install OpenCV Docker Image on Ubuntu, MacOS or Windows
Guide to Install OpenCV 4.0 and 3.4.1 Docker Images on Ubuntu, MacOS, and Windows. The images also come preloaded with dlib.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
4.6.0.66 has some issue and conflicts with conda (not with regular python) so the current solution is
pip install opencv-python-headless==4.5.5.64