Home > Net >  Error when loading imutils: libgtk-3.so.0: cannot open shared object file: No such file or directory
Error when loading imutils: libgtk-3.so.0: cannot open shared object file: No such file or directory

Time:03-23

I was trying to code a motion detection mechanism on my raspberry pi with Python when I ran into this problem. When I installed both imutils and opencv-python and attempted to run my program, this error message shows up.

Traceback (most recent call last):
  File "catfeeder.py", line 1, in <module>
    import imutils
  File "/usr/local/lib/python3.5/dist-packages/imutils/__init__.py", line 8, in <module>
    from .convenience import translate
  File "/usr/local/lib/python3.5/dist-packages/imutils/convenience.py", line 6, in <module>
    import cv2
  File "/usr/local/lib/python3.5/dist-packages/cv2/__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: libgtk-3.so.0: cannot open shared object file: No such file or directory

The same error appears if I attempt to import cv2.

Traceback (most recent call last):
  File "catfeeder.py", line 1, in <module>
    import cv2
  File "/usr/local/lib/python3.5/dist-packages/cv2/__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: libgtk-3.so.0: cannot open shared object file: No such file or directory

Is there a way to fix this?

CodePudding user response:

Ok, I fixed this after some attempts and searching. I installed the dependencies from the accepted answer in this question and it got fixed, in case anyone else run into the same problem that I did.

  • Related