I am using Postgres and Pandas and having trouble with connecting the two. I have created the enginestr using SQLAlchemy as below
from sqlalchemy import create_engine
engine = create_engine('postgresql://postgres:password@localhost:5432/bilal')
However, when i run that statement i get the following error
ImportError : No module names 'psycopg2'
I have tried installing the module but dont have any luck. Is it because i am using a 32 bit Windows machine ?
Thanks,
Bilal
midori
4,8375 gold badges37 silver badges62 bronze badges
1 Answer 1
Did you install it correctly?
Use this link to download and install it win-psycopg or using pip install psycopg2
And you could specify it in the connection string:
from sqlalchemy import create_engine
engine = create_engine('postgresql+psycopg2://postgres:password@localhost/bilal')
answered Jan 6, 2016 at 21:49
midori
4,8375 gold badges37 silver badges62 bronze badges
Sign up to request clarification or add additional context in comments.
6 Comments
Bilal Mussa
Just ran the above and got this from sqlalchemy import create_engine engine = create_engine('postgresql+psycopg2://postgres:password@localhost/bilal') ImportError: No module named 'psycopg2' pip didnt install the module. Anaconda only shows it available for win64
midori
try the first link it for win specifically, the error says your psycopg2 is not installed, that's why it can't be imported
midori
download it from here stickpeople.com/projects/python/win-psycopg/2.6.1/…
Bilal Mussa
do you have a link for python 3.4 / 3.5 ?
midori
i gave it to you twice, check above
|
Explore related questions
See similar questions with these tags.
default
psycopg2?