[Tutor] Pygraphics crashed

Oscar Benjamin oscar.j.benjamin at gmail.com
Fri May 17 16:31:40 CEST 2013


On 17 May 2013 05:56, eryksun <eryksun at gmail.com> wrote:
> On Thu, May 16, 2013 at 6:15 PM, Jim Mooney <cybervigilante at gmail.com> wrote:
>> How do I install PIL with easy-install? I used that once but forget
>> how.  I seem to recall reading it installs a version that is Py native
>> and doesn't choke on your OS. Or did I read that wrong?
>
> I recommend pip instead of easy_install because it allows you to
> easily uninstall.

I don't recommend using pip over easy_install for something like PIL
on Windows (for the reasons that you list below).

>
> First install distribute:
> http://python-distribute.org/distribute_setup.py
>
> Next install pip:
> https://raw.github.com/pypa/pip/master/contrib/get-pip.py
>
> Quickstart guide:
> http://www.pip-installer.org/en/1.3.1/quickstart.html
>
> On Windows, pip and easy_install are a bit limited. I gather that the
> new Wheel package format (.whl) and compatibility tags should solve
> the problem (see PEPs 427 and 425).

The wheel format will solve part of the problem in that it will make
it safer and easier to install prebuilt binaries. It will still
require someone to create all of the prebuilt binaries for each
OS/architecture/Python version and it doesn't really make this step
any easier than creating e.g. an MSI installer is now.

> The development version of pip
> supports Wheel. As is, pip works just fine for installing pure Python
> packages from source. easy_install also supports binary eggs, but I
> dislike not having an easy way to uninstall. At least an exe/msi
> installer lets you uninstall using the Windows control panel.

Precisely. I would probably use an MSI for this (if available).

> If you have a supported C compiler configured, you can use pip to
> install packages that have self-contained C extensions (i.e. no
> dependencies -- such as psutil or cython). Visual Studio [Express] is
> recommended (2008 for 2.6-3.2; 2010 for 3.3), especially if C++ is
> used, but MinGW-w64 can be made to work. The big problem here is
> Windows lacks dependency management for installing libraries and
> development files (headers and import libs) to known system locations.
> So compiling an extension module that has dependencies needs to be
> configured manually.

Since my own Windows machine has the wrong version of Visual Studio
(and out IT policy won't let me change it) I use mingw. However, every
time I install a new Python I have to patch distutils to fix the
'-mnocygwin' bug that prevents current Python from working with it.
Why this issue (http://bugs.python.org/issue12641) is still unresolved
despite being fully understood two years ago I don't understand.

> PIL has a lot of dependencies: libjpeg, libtiff, zlib, freetype2,
> littleCMS, libwebp, and Tcl/Tk. Building it is a moderately
> challenging process on Windows -- not really suited for a beginner.
> Building NumPy/SciPy would be even more work since they need a Fortran
> compiler, too. Fortunately for Windows users, Christoph Gohlke has
> already done all the hard work for dozens of the most popular
> packages.

My own suggestion to coworkers who are new to Python and using Windows
or OSX (without macports) is to use either the Enthought Python
Distribution (free for academic use) or Python(x, y) (free for
anyone). These will install and setup the bulk of packages commonly
used in scientific work from a single installer. Either distribution
will install and setup numpy, scipy, PIL, mingw, pip, distribute, and
many more hard to build packages.

See here for the lists of what each distribution includes:
https://www.enthought.com/products/canopy/package-index/
https://code.google.com/p/pythonxy/wiki/Welcome


Oscar


More information about the Tutor mailing list