I've been doing a lot of reading lately about Heroku and I'm thinking about moving over to it. I thought I would give their little tutorial a try and play around with it a bit.
Ok. Time for a confession. While I have virtualenv installed, I don't really use it. I'm not a guy that has to switch between different projects very often (e.g. like a contractor my need to do). I really like the idea of it, but just not that experienced. I know everyone says that it's best practices these days.
The problem that I have is that I can't get pip to install psycopg2 (which is a part of the tutorial). Btw, here's a link to what I'm trying to do (heroku article)
So, this is not a new problem for me. I've never been able to get the thing to install via pip. I always get the problem
Unable to find vcvarsall.bat
The way that I've solved it in the past on a windows machine was to just download the prebuild libs. If anyone is interested and doesn't know, you can find these here! Btw, thank you Christoph Gohlke for maintaining these!!!!
If you search for this vcvarsall.bat error, you will find several posts for it on Stackoverflow. NONE of them helped me. I originally tried to go the MingGW route. After literally 2 nights of effort (and I think I tried every suggestion I could find), I quit trying (right before I threw my PC out the window and went on a kitten-killing rampage). So, I tried the other route that people suggest - which is to download VC++ 2008 Express edition from Microsoft. Apparently, Python for Windows is built with VC++ 2008 and for some people this is a much easier route than using MinGW. This seems to have worked much better for me, because I can at least get pip to install it. But, when I try to import, I get another common problem people seem to have (at least you get hits when you google it).
File "C:\foo\bar\venv\lib\site-packages\psycopg2__init __.py", line 67, in from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: DLL load failed: The operating system cannot run %1.
After some research, it seems like this is a problem with the compiled _psycopg.pyd file trying to link in libpq.dll. This file is in C:\Program Files (x86)\PostgreSQL\9.1\bin\ - and that is in my path.
So, does anyone know how to fix this? Or is there a way to get pip to use pyscopg2 that is already successfully installed (via the prebuilt libs) in my site-packages? Note: I can make the problem go away if I just copy my prebuilt psycopg2 package into the site-packages of the virtual environment. it will import fine. However, when you do pip freeze for the requirements for heroku, it's not there. Is there a way to fake heroku out on this?
Environment is: Windows 7 (64bit), Python 2.6.5, Django 1.3.1, virtualenv 1.6.4, PostgreSQL 9.1, pip 1.0.2