0

I have a python program that runs fine on one machine. On another machine, I always get an import error. After

  • uninstalling python,
  • uninstalling all pip package,
  • reinstalling a new version of python,
  • rebooting,
  • reinstalling all pip packages

Nothing changed for me. I am faced with exactly the same error

Traceback (most recent call last):
  File "c:\project\openTemplates.py", line 8, in <module>
    from python_imagesearch.imagesearch import imagesearch
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\python_imagesearch\imagesearch.py", line 1, in <module>
    import cv2
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\cv2\__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, 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.

What can I do to solve this. I don't understand what module is missing. From the error message I can see that cv2 is clearly there in the file system in the expected place.

In particular, how does one go about finding what is the specified module which could not be found?

SlightlyKosumi
  • 701
  • 2
  • 8
  • 24
  • 2
    Does this answer your question? [DLL load failed error when importing cv2](https://stackoverflow.com/questions/43184887/dll-load-failed-error-when-importing-cv2) – Bilal Mar 21 '23 at 08:25
  • Thank you for answering. I may have already read this question, there are some which are quite similar. Most of the suggestions I've tried already. For example - I've installed opencv[-*] through pip, and that hasn't helped. It also doesn't help me diagnose where the module import fails. Also in particular, the accepted answer there simply does not work. – SlightlyKosumi Mar 21 '23 at 08:34
  • I've also just tried installing opencv itself from sourceforge, it fails to resolve the issue. – SlightlyKosumi Mar 21 '23 at 08:59

0 Answers0