Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved reference flask_sqlalchemy

I am using Pycharm, with python 3.8 and I am watching a flask tutorial for beginners. this means that I am a beginner so I might not understand every vocab or solution, however, a little research on my end will make it alright.

So the problem I am having is that I downloaded flask_sqlalchemy with the following code on the PyCharm terminal:

pip install Flask-SQLAlchemy

I thought I had been successful since the event log also said installation successful. However, when I wrote the following code:

from flask_sqlalchemy import SQLAlchemy

it reported "unresolved reference flask_sqlalchemy"

I then tried entering this in the terminal thinking it would work:

pip install -U Flask-SQLAlchemy

Nothing changed.

I tried installing SQLAlchemy to see if it would do something but it didn't. I used the following code in the terminal:

pip install SQLAlchemy

Any ideas on how to get this to work?

like image 851
Thepurplelounge.com Avatar asked Sep 10 '26 11:09

Thepurplelounge.com


1 Answers

Go to File -> Preferences -> Python Interpreter. Hit the plus button and install the package SQLAlchemy.

If that does not work, go to File -> Invalidate Cache.

What finally worked for me was deleting the venv folder, deleting the interpreter, and creating a new one. Make sure to enable inheritance of global packages because when you use pip3 install Flask-SQLAlchemy it installs to the default interpreter.

You really should be able to install it to your virtual environment. But I spent 3hrs on it and couldn't figure out how.

If you're still stuck, refer to "Python shows unresolved references error for valid code.

like image 200
Mike Chase Avatar answered Sep 12 '26 02:09

Mike Chase



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!