• Register
0 votes
201 views

Problem:

Tried running a file with the following imports:

from flask_sqlalchemy import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker

Received the following error:

ImportError: No module named 'flask_sqlalchemy'

SQLAlchemy is installed. Still, I tried to reinstall into the directory in which it will be used.

13k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution:

 SQLAlchemy is an expansion for Flask that adds uphold for SQLAlchemy to your application. It intends to improve on utilizing SQLAlchemy with Flask by giving valuable defaults and additional assistants that make it simpler to achieve regular assignments.

It would seem that you may have just introduced the SQLAlchemy bundle and NOT the Flask Extension. Attempt pip introduce Flask-SQLAlchemy

I think you have a befuddle between your pip and python variants. check your pip form pip - adaptation, in the event that it is pip3

you can attempt this,

sudo adept get introduce python3-sqlalchemy

This should work.

~$ python3

>>import sqlalchemy

In the event that you are on macintosh, attempt pip introduce cup sqlalchemy rather than pip3 introduce flagon sqlalchemy.

It works for certain admonitions, yet had the option to succesfully associate with the data set and make the tables. "FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds critical overhead and will be incapacitated naturally later on. Set it to True or False to stifle this notice."

At last, I settled this issue ages after I posted the above inquiry.

The fix was to run all bundle refreshes and introduces through Anaconda and manage my job in Spyder.

The exercise learned was straightforward: Once you begin utilizing Anaconda as your go-to climate for everything Python, all updates - made through conda introduce or pip - will be arranged and set in your framework by Anaconda of course.

Perhaps it is a pip way issue. In the event that utilizing conda virtual env (with boa constrictor or miniconda), check which pip and which python in linux (discover your pip and python way) and ensure they're adjusted. Fix your pip way issue or rather than pip introduce flask_sqlalchemy do a

24.2k points

Related questions

0 votes
1 answer 56 views
56 views
Problem: What is wrong here : Modulenotfounderror: no module named 'urlparse'?
asked May 25 Chi Omega 159k points
0 votes
1 answer 22 views
22 views
Problem: Please,I want an answer : Modulenotfounderror: no module named 'pyperclip'
asked May 24 Sawyer Parviz 158k points
0 votes
1 answer 24 views
24 views
Problem: Looking at the Python install, it gives the error: modulenotfounderror: no module named '_sqlite3.' Now, do I need to reinstall Python, or is there another way to get this module up and running?
asked Apr 18 anika11 32.2k points
0 votes
1 answer 113 views
113 views
Problem: how to I Solve this: modulenotfounderror: no module named '_sqlite3' HELP! I need help understanding this: modulenotfounderror: no module named '_sqlite3' Can someone please help solve this, I am new in python(). Someone have idea to solve this thanks!
asked Mar 10 Mashhoodch 13k points
0 votes
1 answer 72 views
72 views
Problem: How to I Solve this: modulenotfounderror: no module named 'seaborn' HELP! I need help understanding this: modulenotfounderror: no module named 'seaborn' Can someone please help solve this, I am new in python(). Someone have idea to solve this thanks!
asked Mar 5 Mashhoodch 13k points
0 votes
1 answer 26 views
26 views
Problem: Why I got the error : modulenotfounderror: no module named 'pip._internal' How to fix this erro: modulenotfounderror: no module named 'pip._internal' HELP! I need help understanding this error: modulenotfounderror: no module named 'pip._internal' Any ideas on what I need to do to fix this? Thanks!
asked Feb 28 Mashhoodch 13k points
0 votes
1 answer 410 views
410 views
Problem: I am using Ubuntu and have installed Python 2.7.5 and 3.4.0. In Python 2.7.5 I am able to successfully assign a variable x = Value('i', 2), but not in 3.4.0. I am getting: Traceback (most recent call last): File "<stdin>", line 1, ... File "/usr/local/lib/python3.4/ctypes/__init__.py", line 7, in <module> from _ctypes import Union, Structure, Array ImportError: No module named '_ctypes'
asked Jan 26 Mashhoodch 13k points
0 votes
1 answer 324 views
324 views
I'm installing python on my windows 10 laptop, and when I try to run it I get this. Fatal Python error: Py_Initialize: unable to load the file system codec ModuleNotFoundError: No module named 'encodings' Current thread 0x0000037c (most recent call first):
asked Oct 25, 2020 psandprop 2.4k points
0 votes
1 answer 158 views
158 views
I wanna use scikit-learn. I have typed pip install -U scikit-learn pip3 install sklearn to install it; but when i type $ Python >>> import sklearn it returns ImportError: No module named sklearn I followed other tutorials, but it doesn't work. Furthermore, my enviroment ... . What is the true code to type in the terminal? I tried to type python setup.py installin the terminal but it doesn't work
asked Oct 24, 2020 psandprop 2.4k points
0 votes
1 answer 101 views
101 views
Question: I have installed python 3.3.2 and pygame 1.9.2a0. Whenever I try to import pygame by typing: import pygame I get following error message : Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32 Type " ... 'pygame' >>> I went through some of the questions related to this error but none of the solution helped. I have 64 bit machine with Win7 OS
asked Apr 14 munim01 21k points