'Error: While importing 'wsgi', an ImportError was raised. Python Flask Ubuntu 20.04
I am building a backend using Python and Flask, everything worked fine, but after some updates on the Pipfile (updated some packages) I got this error when I try to run the app (flask run):
Error: While importing 'wsgi', an ImportError was raised.
Environment:
- Ubuntu 20.04
- Python 3.8.5
- Flask 2.0.2
- pipenv 2020.8.13
- pip 21.2.4
Also, I tried with pyenv 1.2.21
I tried to run the backend in VSC but got the same error. Also, I tried to remove the interpreter and set it up again, remove Pipfile.lock, and pipenv install again... I have googled but found nothing about this error.
Thanks in advance!
Solution 1:[1]
Add the file __init__.py
to the application directory
Solution 2:[2]
Try python wsgi.py
and check output, maybe you should install additional requirements.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Aleksey Halyvin |
Solution 2 | Artem S. Zhelonkin |