1
votes

The other day I asked a question about why I couldn't install psycopg2 on my mac. The problem, I realized, lies with python3.

I am working with flask and have been running in a virutalenv that uses python3. When attempting to install psycopg2 (using pip install psycopg2), it fails miserably. I attempted the same thing on the ubuntu virtual machine on my computer, with the same problem. However, when I attempt to install psycopg2 on a virtualenv using the python version installed on my computer (2.7.2), it works fine. It also works on the Ubuntu side.

Hence, the problem is with using python3 in the virtualenv. My friend and mentor helped me develop a workaround on my Ubuntu side. Essentially what we did was download python3, then modify the .bashrc to use the new python3 when typing python3 from terminal. Then, when we setup a new virtualenv using the downloaded python3, and attempted to download psycopg2, there wasn't the problem at all!

Now, so I want to use python3 with projects I am working on, and because I am deploying through Heroku, I need to use psycopg2 to link up my databases. Can anyone help me figure out a workaround on my mac side? Thanks!

P.S. -> Here's the link to my original question: Can't install pscyopg2 on mac OS X 10.8.4 (Not sure what happened to the comments and original answer from the other stackoverflow user)

1
I use linux, but got error on import psycopg2. So, indeed the problem i see is in python3. But i've also upgraded pip version from 1.2.1 to 1.4.1 and unfortunately it didn't help. Will try something else. On of the solutions described is to add compiled psycopg2 to PATH, but it smells as bad monkeypatching...boldnik

1 Answers

0
votes

I solved this exact problem by installing python3-dev first.