Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open CV (CV2) is not loading with Metacall #33

Closed
wants to merge 23 commits into from

Conversation

RohanKrMahato
Copy link
Contributor

Bug Report: OpenCV(cv2) Not Loading with MetaCall on Windows 11

Description

When trying to execute a Python script (openCV_MetacallCheck.py) that uses OpenCV through MetaCall on a Windows 11 machine, I found the following error. The script runs successfully when executed directly with Python but fails when executed using MetaCall.

Here I'm attaching the python script and the Terminal output:

import cv2
print(cv2.__version__)
PS C:\Users\Rohan Kumar Mahato\Desktop\metacalltest> metacall openCV_MetacallCheck.py
Traceback (most recent call last):
  File "py_loader_impl_load_from_file_path", line 33, in load_from_path
  File "py_loader_impl_load_from_file_path", line 8, in load_from_spec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\Rohan Kumar Mahato\Desktop\metacalltest\openCV_MetacallCheck.py", line 1, in <module>
    import cv2
  File "C:\Users\Rohan Kumar Mahato\AppData\Local\MetaCall\metacall\runtimes\python\lib\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "C:\Users\Rohan Kumar Mahato\AppData\Local\MetaCall\metacall\runtimes\python\lib\cv2\__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "C:\Users\Rohan Kumar Mahato\AppData\Local\MetaCall\metacall\runtimes\python\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing cv2: The specified module could not be found.

Error: Python Error: Exception raised while loading the module 'openCV_MetacallCheck.py'
Error: Python <class 'ImportError'>: DLL load failed while importing cv2: The specified module could not be found.
Traceback (most recent call last):
  File "py_loader_impl_load_from_file_path", line 33, in load_from_path
  File "py_loader_impl_load_from_file_path", line 8, in load_from_spec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\Rohan Kumar Mahato\Desktop\metacalltest\openCV_MetacallCheck.py", line 1, in <module>
    import cv2
  File "C:\Users\Rohan Kumar Mahato\AppData\Local\MetaCall\metacall\runtimes\python\lib\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "C:\Users\Rohan Kumar Mahato\AppData\Local\MetaCall\metacall\runtimes\python\lib\cv2\__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "C:\Users\Rohan Kumar Mahato\AppData\Local\MetaCall\metacall\runtimes\python\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing cv2: The specified module could not be found.

Error: Failed to load script 'openCV_MetacallCheck.py' with loader 'py'
PS C:\Users\Rohan Kumar Mahato\Desktop\metacalltest>

This is the version of the openCV I was using:

PS C:\Users\Rohan Kumar Mahato\Desktop\metacalltest> metacall pip show opencv-python
Name: opencv-python
Version: 4.10.0.84
Summary: Wrapper package for OpenCV python bindings.
Home-page: https://github.com/opencv/opencv-python
Author:
Author-email:
License: Apache 2.0
Location: c:\users\rohan kumar mahato\appdata\local\metacall\metacall\runtimes\python\lib
Requires: numpy
Required-by:

@viferga
Copy link
Member

viferga commented Dec 12, 2024

Closing in favor of: #34

@viferga viferga closed this Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants