I\'m unable to find a module in python ,though easy_install says its already installed. Any idea how to resolve this isseue?
$ python -c \"from flaskext.sql
first install the library
pip install flask_sqlalchemy
after that
from flask_sqlalchemy import SQLAlchemy
put this in app.py file to get the access of database through SQLAlchemy
Okay,I have re-installed the package via pip even that didn't help. And then I rsync'ed the entire /usr/lib/python-2.7 directory from other working machine with similar configuration to the current machine.It started working. I don't have any idea ,what was wrong with my setup. I see some difference "print sys.path" output earlier and now. but now my issue is resolved by this work around.
EDIT:Found the real solution for my setup. upgrading "sqlalchemy only doesn't solve the issue" I also need to upgrade flask-sqlalchemy
that resolved the issue.
Very late to the party but hopefully this will help someone, was in the same situation for about a hour without any of the solutions mentioned above working. (On a Windows 10 machine).
In the Settings/Preferences dialog (Ctrl+Alt+S), from the side menu select Project: | Project Interpreter.
Check which packages you currently have installed (You need SQLAlchemy and Flask-SQLAlchemy). Double click on any package name, an 'Available Packages' menu will open.
Search for the missing package(s) and click install.
I'm new comer, use python 3.8 and met the same problem. I installed with pip
instead of pip3
because i thought the pip installer is the same for python2 and python3
so this is proper installation
pip3 install flask_sqlalchemy
I just experienced the same problem using the virtual environment.
For me installing the package using python from the venv worked:
.\venv\environment\Scripts\python.exe -m pip install flask-sqlalchemy
Solution for me was to use:
from flask_sqlalchemy import SQLAlchemy
instead of
from flask.ext.sqlalchemy import SQLAlchemy