3

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?

1 Answers1

1

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.

Mike Chase
  • 19
  • 6