I’m encountering an issue in PyCharm where it’s not recognizing the Flask-WTF import statement in my Flask project. Specifically, I have Flask-WTF version 1.0.0 installed in my Python environment, but PyCharm is showing a red line under from flask_wtf import FlaskForm
.
Here’s a snippet of my requirements.txt
file:
blinker==1.7.0
Bootstrap-Flask==2.2.0
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
Flask==2.3.2
Flask-WTF==1.0.0
idna==3.6
itsdangerous==2.2.0
Jinja2==3.1.3
MarkupSafe==2.1.5
packaging==24.0
pillow==10.2.0
python-dotenv==1.0.1
requests==2.31.0
urllib3==2.2.1
webdriver-manager==4.0.1
Werkzeug==3.0.0
WTForms==3.0.1
I’ve already verified that Flask-WTF is installed correctly using pip list
, and the package is indeed listed there. I’ve also tried the following troubleshooting steps:
- Cleared PyCharm’s cache using
File
>Invalidate Caches / Restart...
>Invalidate and Restart
. - Re-imported the project into PyCharm.
- Ensured that PyCharm is using the correct Python interpreter and that it matches the one where Flask-WTF is installed.
- Updated PyCharm to the latest version and checked for updates.
Despite these efforts, the issue persists. I’m not sure what else to try, and any guidance or suggestions would be greatly appreciated.
Thank you in advance for your help!
Best regards,
Ruth Blossom
Ruth Blossom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.