1

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

3
  • Are you sure the error is coming from those two lines you posted, and not from where you're referencing psycopg2? Commented Jan 6, 2016 at 21:44
  • I wasnt successful in install psycopg2 Commented Jan 6, 2016 at 21:59
  • Then you should be asking "How do I install psycopg2 on Windows 32bit?" Commented Jan 6, 2016 at 22:01

1 Answer 1

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')
Sign up to request clarification or add additional context in comments.

6 Comments

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
try the first link it for win specifically, the error says your psycopg2 is not installed, that's why it can't be imported
do you have a link for python 3.4 / 3.5 ?
i gave it to you twice, check above
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.