pythonsqlalchemypycharm

SQLAlchemy successfully installed, but I still get error ModuleNotFound


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.


Solution

  • Try to delete and install again sqlAlchemy via terminal:

    pip uninstall SQLAlchemy
    pip install SQLAlchemy
    

    Or upgrade it:

    pip install SQLAlchemy --upgrade