Open LOActualControl opened 1 year ago
Good afternoon,
I'm also getting the same issue but with Azure cloud platform. However, I'm not sure why we need tkinter because of the following: It seems like he is defining Image in line 2 but later he redefines Image in line 5 , so this leads me to believe that perhaps we do not need tkinter? Thoughts ?
Yeah I noticed the same thing too @EdwinAguirre92 ! In fact, I assume the rest of the Image references in the functions/classes that follow are from the PIL import, rather than the tkinter import. Perhaps tkinter isn't necessary after all - I ended up actually using a different package than ImageAI for my current project, but removing tkinter could be helpful for future projects.
Good afternoon,
I'm trying to upload a trained Custom Object Detection model to Google Cloud Storage and run inference using a Cloud Function. However, when I upload my function to the Google Cloud Platform, importing the CustomObjectDetection module fails. I think this is because one of the required packages is tkinter, which might not work in a cloud/headless platform? But I can't figure out why tkinter/a GUI would be required for imageai. Any help toward resolving this would be greatly appreciated! My code and the full stack trace of my error is below:
`import numpy as np from imageai.Detection.Custom import CustomObjectDetection
def predict(self): return "hello world"`
Deployment failure: Function failed on loading user code. This is likely due to a bug in the user code. Error message: Traceback (most recent call last): File "/layers/google.python.pip/pip/bin/functions-framework", line 8, in
sys.exit(_cli())
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/click/core.py", line 1128, in call
return self.main(args, kwargs)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, ctx.params)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(args, **kwargs)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/functions_framework/_cli.py", line 37, in _cli
app = create_app(target, source, signature_type)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/functions_framework/init.py", line 288, in create_app
spec.loader.exec_module(source_module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/workspace/main.py", line 2, in
from imageai.Detection.Custom import CustomObjectDetection
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/imageai/Detection/init.py", line 2, in
from tkinter import Image
File "/layers/google.python.runtime/python/lib/python3.9/tkinter/init.py", line 37, in
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libBLT.2.5.so.8.6: cannot open shared object file: No such file or directory
. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.