Skip to content
Advertisement

OpenCV on Flask only works with “flask run” and not under Apache2

I want to use Open CV on a Flask Server but when I import cv2 and load up the page on my browser, it get the Error ERR_EMPTY_RESPONSE. I get no import erros or other exceptions from Flask itself, only this notice from my Apache2 logfile.

[Sun Jan 03 14:07:44.895826 2021] [core:notice] [pid 20595] AH00052: child pid 20600 exit signal Aborted (6)

I have tried running it with flask run --host('0.0.0.0') and everything worked fine and Cv2 routes worked completly fine.

I don’t know what’s the cause of this problem, because Open Cv works fine in every other python app and other Flask installations and only doesn’t in this specific instance!

EDIT: It seems as if it had do with something in my old Virtual Enviroment, I created a new one and everything is working fine now.

Advertisement

Answer

Not really great to do it this way, but what worked was to put the flask app into a new and fresh virtual enviroment and tell apache to use it when executing the .wsgi file.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement