Problems with psycopg2 on Windows 7 64 bit

206 views
Skip to first unread message

Daniel Grace

unread,
Sep 27, 2014, 10:07:43 AM9/27/14
to django...@googlegroups.com
I have installed Python 3.4, Django 1.7, Postgresql 9.3 and psycopg2-2.5.4 (using the Windows installer at http://www.stickpeople.com/projects/python/win-psycopg/)

When I try a syncdb command from my virtualenv I get the following error:

(landy) C:\landy\cresta>python manage.py syncdb
Traceback (most recent call last):
  File "C:\landy\lib\site-packages\django\db\backends\postgresql_psycopg2\base.p
y", line 23, in <module>
    import psycopg2 as Database
ImportError: No module named 'psycopg2'

I am not sure if I needed to do:
> pip install psycopg2

...which gives the following:

error: Unable to find vcvarsall.bat

I have Visual Studio 2012 installed if that helps?  Any other ideas?

Thanks.

Daniel Grace

unread,
Sep 27, 2014, 11:47:06 AM9/27/14
to django...@googlegroups.com
I got around this particular problem.  The Windows installer for psycopg (at http://www.stickpeople.com/projects/python/win-psycopg/) installs for the global instance of Python,
not the virtualenv.  I copied the psycopg folder and the "egg-info" file to the virtualenv and the "No module named..." error disappeared.

Mike Dewhirst

unread,
Sep 28, 2014, 12:17:21 AM9/28/14
to django...@googlegroups.com
On 28/09/2014 1:47 AM, Daniel Grace wrote:
> I got around this particular problem. The Windows installer for psycopg
> (at http://www.stickpeople.com/projects/python/win-psycopg/
> <http://www.google.com/url?q=http%3A%2F%2Fwww.stickpeople.com%2Fprojects%2Fpython%2Fwin-psycopg%2F&sa=D&sntz=1&usg=AFQjCNGss5TWliAyF_rFvd5Lc6WD_zz7ng>)
> installs for the global instance of Python,
> not the virtualenv. I copied the psycopg folder and the "egg-info" file
> to the virtualenv and the "No module named..." error disappeared.

Another solution is to download the appropriate psycopg2 binary from
http://www.lfd.uci.edu/~gohlke/pythonlibs/ to a local download dir and
use easy_install to install it from there. Quite useful for virtualenv
setups.

I have tried the local compilation road and won't bother ever again
while Chris Gohlke lives!

Cheers

Mike


>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d3d5f9c6-8309-4105-bcd8-e94c0afbc16d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d3d5f9c6-8309-4105-bcd8-e94c0afbc16d%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages