Take the 2-minute tour ×

I'm attempting to install the PIL library in an Virtual Enviroment that I have created.

Usually to install PIL I'd grab the install, however this won't allow me to choose my virtualenv only my root Python folder (C:/Python26).

I tried both pip install PIL and easy_install PIP but they didn't work. I've also tried downloading the TAR, extracting and running setup.py install

Django is still rejecting my model which contains an ImageField(). Does anyone have a solution?

An error which commonly occurs is below:

Unable to find vcvarsall.bat


OK I tried a fresh virtualenv and used easy_install which isn't showing the compile error.

I then open a Python shell and it allowed me to import PIL and import _imaging, however when I try to use the ImageField() in django my models still won't validate.

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

OK this appears to be a VirtualEnv problem.

Despite making a new VirtualEnv with the --no-site-packages argument, my Django site is fetching the django files from the root install C:/Python26/Lib/site-packages/ rather than locally.

Django then attempts to fetch PIL in the root site-packages which it cannot find and results in an error.

I have no idea why this is occurring. If I open the python interpreter the root django files do not appear on the path.

Once remedied easy_install PIL should work.

share|improve this answer
add comment

Rename from PIL-1.1.7-py2.6-win32.egg to PIL in site-packages dir.

share|improve this answer
Wow, that was annoying. Thanks. –  Tom Jan 23 '13 at 20:35
add comment

Do you have (the latest version of) Visual Studio installed?

That's where vcvarsall.bat comes from, and what building any Python extension from C sources on Windows would prefer to use (there are ways of using mingw instead, if that's your actual problem).

(I'm saying "the latest version" because I believe that's what the python.org distribution of Python 2.6 for Windows is built with).

share|improve this answer
I have Visual Studio 2010 installed, not sure were to go from here though. –  Ash Jul 9 '10 at 0:56
@Anarchist, is the directory where that .bat lives on your PATH environment variable? –  Alex Martelli Jul 9 '10 at 2:11
I've added it to the PATH but still it saying it cannot be found. –  Ash Jul 10 '10 at 13:14
I think 2.6 is build with VS2008 –  Mark0978 Aug 18 '11 at 14:22
add comment

Your Answer


