pip win32 bug

This pip gotchya can cause difficult-to-troubleshoot errors.

This little pip bug causes pip to install 32-bit versions of wheels that contain binary components for 64-bit Python installs and virtual environments if you have the Visual Studio command-line build environment active (vcvarsall.bat, vsdevcmd.bat, etc.).

This can lead to import errors and other problems the cause of which may not be immediately obvious. Notably with Pillow, you will get something like:

from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\keath\Workspace\KMX\test\.virtualenv\lib\site-packages\PIL\Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (C:\Users\keath\Workspace\KMX\test\.virtualenv\lib\site-packages\PIL\__init__.py)

The only fix for now is “don’t do that” - make sure you aren’t doing pip installs in a Visual Studio build tools environment.