ModuleNotFoundError: No module named 'sqlalchemy'
14,393
It sounds like sqlalchemy did not install. You can try using sudo pip3 install sqlalchemy
.
You can confirm the install by running python in interactive mode and using the following commands:
$ python3
>>> import sqlalchemy
>>> sqlalchemy.__version__
This should give you the version of sqlalchemy you have.
Related videos on Youtube
Author by
Suchitra
Updated on June 04, 2022Comments
-
Suchitra about 2 years
I am new to sqlalchemy and trying to create tables in mysql.Created a virtual environment and executed below commands. pip3 install sqlalchemy pip3 install sqlalchemy-migrate
Python version- 3.6.4 but when I try to execute the command "python models.py" on terminal it pops an error
File "models.py", line 1, in <module> from sqlalchemy import Table, Column, Integer, MetaData, ForeignKey, DateTime, Float, BigInteger, String, func ModuleNotFoundError: No module named 'sqlalchemy'
from sqlalchemy import Table, Column, Integer, MetaData, ForeignKey, DateTime, Float, BigInteger, String, func import helper.connection_util as connection_util metadata = MetaData() # employee TABLE employee = Table('employee', metadata, Column('employee_id', Integer, primary_key=True), Column('employee_name', String(100)), Column('employee_designation', String(100)), metadata.create_all(connection_util.get_connection())
-
Morse over 6 yearsdid u add
import sqlalchemy'
? -
Ilja Everilä over 6 yearsDid you activate said virtual env? And are you sure
pip3
is the command from your venv, and not for examplepip
? -
Suchitra over 6 yearsYea i have added import sqlalchemy' @prateek , also activated my virtual env and its pip3
-
-
Suchitra over 6 yearshad to uninstall sqlalchemy and install again for it to be working. Issue resolved now. Thanks for the help.