Forums

Please help getting error on the time publish a flask application on your server.

Hi all,

I am getting error on the time of publishing a flask application on your server that showing CV2 not found, But I already install opencv-python for python3.7 through pip3 and it's showing in the list.

The log file showing

2020-01-07 07:12:44,340: Error running WSGI application 2020-01-07 07:12:44,344: ModuleNotFoundError: No module named 'cv2' 2020-01-07 07:12:44,344: File "/var/www/deanp_pythonanywhere_com_wsgi.py", line 16, in <module> 2020-01-07 07:12:44,345: from flask_app import app as application # noqa 2020-01-07 07:12:44,345: 2020-01-07 07:12:44,345: File "/home/deanp/mysite/flask_app.py", line 7, in <module> 2020-01-07 07:12:44,345: import cv2

The pip3 list

opencv-contrib-python-headless 4.1.1.26
opencv-python 4.1.2.30
openpyxl 3.0.0

I have a flask application by which we are detecting faces from image.

Thanks in advance Please guide me to solve this problem.

pip3 does not necessarily install into Python 3.7. Use pip3.7 to ensure that you're installing into Python 3.7.

Thanks Glenn for your reply. I already tried that only.

Have you reloaded your web app since installing it?

I would use a virtual environment for all modules; in this article I explained how to do it: https://antonioblago.medium.com/flask-tutorial-how-to-deploy-and-publish-an-app-on-pythonanywhere-225314160914