Chris Yin
Chris Yin

Reputation: 791

PIP/easy_install PIL in Virtualenv vcvarsall.bat error Windows 7

So I know there's a fair amount of documentation on this already, but I just can't seem to get it to work. I'm deploying a Django app to Heroku, and am trying to install PIL into my virtualenv (a main part of the app requires user uploaded images).

I've tried both

easy_install PIL

and

pip install PIL

and everyone the installation ends in

error: Unable to find vcvarsall.bat.

How can I get PIL into my virtualenv? Can anyone walk me through it?

Thanks!

Upvotes: 9

Views: 6083

Answers (4)

Tommy Gibbons
Tommy Gibbons

Reputation: 326

To install Pillow For this you need a compiler installed on computer, using Microsoft Visual Studio 9.0 (2008) Express Edition (Free). You need this c++ compiler for pillow to install. Install from here

http://download.microsoft.com/download/A/5/4/A54BADB6-9C3F-478D-8657-93B3FC9FE62D/vcsetup.exe

open cmd prompt and enter the following

"C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat" 

this updates the PATH variable (no need for registry hacks, even in a virtualenv).

Because of firewall difficulties I usually pip install from a local directory

pip install -e c:\django\test_virtualenv\Pillow

Pillow must be the correction version for your O/S and computer architecture.

Upvotes: 1

Ulises
Ulises

Reputation: 13429

As stated in other answers Pillow is the way to go since PIP is not compatible with setuptools.

So you may just do:

pip install pillow

Now, since you are working on windows you may run into compilation issues. You will need to install a gcc compiler in order for this to work. I just ran into this issue and blogged about this here.

Upvotes: 1

Steve K
Steve K

Reputation: 11369

I don't know about Windows, but easy_install PIL does not work well. easy_install pillow (compatible with setuptools) does the trick. It will still need compilation if I remember correctly, and then you could have a look there : Unable to find vcvarsall.bat

Upvotes: 2

Danny Hong
Danny Hong

Reputation: 1482

PIL required make.exe or nmake.exe, you may need to install visual studio. vcvarsall.bat is part of visual c++. Please install binary package from http://www.lfd.uci.edu/~gohlke/pythonlibs/

Upvotes: 1

Related Questions