Suchitra
Suchitra

Reputation: 77

ModuleNotFoundError: No module named 'sqlalchemy'

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())

Upvotes: 2

Views: 22758

Answers (1)

mageliz
mageliz

Reputation: 146

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.

Upvotes: 7

Related Questions