views:

2669

answers:

7

I'm trying to install said library for use with Python. I tried downloading the executable installer for Windows, which runs, but says it doesn't find a Python installation. Then tried registering (http://effbot.org/zone/python-register.htm) Python, but the script says it can't register (although the keys appear in my register).

Then I tried downloading the source package: I run the setup.py build and it works, but when I run setup.py install it says the following:

running install
running build
running build_py
running build_ext
building '_imaging' extension
error: Unable to find vcvarsall.bat

What can I do?

A: 

I think I had a similar problem in the past, with another python library. I believe that it was a windows permission issue. Try adding "Users" to your python directory, and give them full access.

mlsteeves
Tried that, but no success. Tried adding 'Everyone' to C:\Python26 too, but no luck either.
Rafael Almeida
A: 

Make sure you have the Visual C++ Redistributable package installed on your machine.

TheMissingLINQ
Rafael Almeida
+4  A: 

Compiling PIL on Windows x64 is apparently a bit of a pain. (Well, compiling anything on Windows is a bit of a pain in my experience. But still.) As well as PIL itself you'll need to build many dependencies. See these notes from the mailing list too.

There's an unofficial precompiled binary for x64 linked from this message, but I haven't tried it myself. Might be worth a go if you don't mind the download being from one of those slightly dodgy file-upload sites. Other than that... well, you could always give up and instead the 32-bit Python binary instead.

bobince
The file posted in the 'dodgy file-upload site' actually worked. But subsequent problems (with other libraries) are leading me to think that giving up and using a 32-bit Linux is going to be the best option. Nevertheless, your solution solves the present issue. =D
Rafael Almeida
I've had no problems with PIL (or anything much recently) on Linux 64-bit. Linux seems to be a bit further along with the x86_64 transition than Windows is, presumably due to the relative ease of recompiling open-source stuff and its prevalence on large-memory servers.
bobince
+1  A: 

If you installed a win64 python, you need a win64 PIL. The official PIL download site only has win32, as far as I can tell. The win32 installer will not see your 64-bit python installation.

No amount of tinkering with permissions or redistributables will fix this. You could use the win32 python instead (the Win64 python is mutant anyhow; Microsoft decided that C 'long' should be 32 bits in their 64-bit world, so python 'ints' are only 32 bits in Win64 python).

Since sizeof(long)!=sizeof(ptr) in win64, porting C extensions can be problematic, and will not be the same as porting them to linux 64. E.g. it seems that Win64 numpy is experimental/broken whereas linux64 numpy has been fine for years. My recommendation is if you use win64, stick with win32 python. If you want 64-bit python use linux.

greg
A: 

Just got this error msg on my 32 bit Windows - I read the FAQ here: http://pythonware.com/products/pil/faq.htm and this sort of indicates that Windows is funny. Looked again at install pg and downloaded the Windows executable for Python26 # Python Imaging Library 1.1.7 for Python 2.6 (Windows only) - and the _imaging module gets installed when you run this. Should solve problem. So you can't just do the python setup.py install routine on: Python Imaging Library 1.1.7 Source Kit (all platforms) (November 15, 2009).

jonathan greenleaf
+1  A: 

I've just had the same problem (with Python 2.7 and PIL for this versions, but the solution should work also for 2.6) and the way to solve it is to copy all the registry keys from:

HKEY_LOCAL_MACHINE\SOFTWARE\Python

to

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python

Worked for me

solution found at the address below so credits should go there: http://effbot.slinkset.com/items/Adding_Python_Information_to_the_Windows_Registry

chodorowicz
the regedit + these files: http://www.lfd.uci.edu/~gohlke/pythonlibs/ made it for me
Guillaume86
A: 

Hey there... I was having the same problem so I decided to download the source kit and install it according to how you posted above...

1 - Downloaded Source Kit 2 - Opened command prompt on that folder and typed python setup.py build 3 - Then I typed python setup.py install

It worked perfectly!

Now, some notes: when I typed python setup.py build, I saw that Microsoft Visual Studio v9.0 C compiler was being used to build everything.

So probably it's something with your compiler not correctly configured or something...

Anyways, that worked with me so thank you!

Rafael