SQLAlchemy successfully installed, but I still get error ModuleNotFound

Question:

I am trying run code which is using SQLAlchemy. I use PyCharm with virtual environment. I don’t have this problem few weeks ago and now I don’t know what is wrong.

What I have tried:

1.) deleting venv folder from project, and set new virtual interpreter.
Didn’t help, I clicked on Install package SQLAlchemy, get notification that package was successfully installed, but it is still underlined and if I try to run, I get error ModuleNotFound…
SQLAlchemy

2.) trying to install it from Terminal in PyCharm

(venv) cipisek@macbookair Starting+Files+-+cafe-api-start % pip3 install SQLAlchemy
Requirement already satisfied: SQLAlchemy in ./venv/lib/python3.9/site-packages (1.4.41)

After this, still same problem. SQLAlchemy2

3.) completely new project, with new virtual environment… same problem :/

4.) importing only SQLAlchemy instead from flask_sqlalchemy import SQLAlchemy import SQLAlchemy

Traceback (most recent call last):
  File "/Users/cipisek/PycharmProjects/Starting+Files+-+cafe-api-start/main.py", line 2, in <module>
    import SQLAlchemy
ModuleNotFoundError: No module named 'SQLAlchemy'

If I tried to check packages which are installed in my environment, the SQLAlchemy is there. I don’t understand why it is not working. List of installed packeges Could someone help me please?

I have found similar problems on this forum, but there aren’t any solutions which solve my problem.

Asked By: cipisek

||

Answers:

I have the same problem, but after reinstalling PyCharm everything works fine.

Or you can try to delete and install again sqlAlchemy via terminal, that also may work:

pip uninstall SQLAlchemy
pip install SQLAlchemy
Answered By: Nero
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.