Let's discuss the matter further

PyEphem available for Windows!

November 9th, 2007

Over the years I have received many requests from frustrated Windows users, asking for a Windows-native version of my PyEphem astronomy library for Python. For most Windows users, an attempt to build the extension ends abruptly with the terrible and famous message:

error: Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn’t installed.

And, as I myself do not have Visual Studio on the small Windows machine that I deign to own for the sake of my photo printer, I have never been able to offer my users much help. But earlier this year, a helpful PyEphem user named Jeff Kowalczyk emailed me a link to Philip von Weitershausen’s post “Cheap binary Windows eggs”, which describes a method for building Python extensions using a freely available compiler.

Aside from the difficulty that the Python setuptools ignored the pydistutils.cfg file he recommended, making it necessary for me to name the compiler on the command line, his instructions produced a PyEphem windows egg with only a few steps:

  • I installed Python for Windows.
  • I installed the setuptools package using its Windows .exe installer (scroll down the page to find it).
  • I installed the MinGW compiler.
  • I installed LibArchive for Windows.
  • I added to my Windows Path:
    C:\Python25;C:\MingW\bin;C:\Program Files\GnuWin32\bin
  • I downloaded the PyEphem source archive.
  • I brought up a command window and ran:
    C:\dev> bsdtar -xf pyephem-3.7.2.1.tar.gz
    C:\dev> cd pyephem-3.7.2.1
    C:\dev\pyephem-3.7.2.1> python setup.py build --compiler=mingw32
    C:\dev\pyephem-3.7.2.1> python setup.py bdist_egg
    
  • I uploaded the egg in the dist directory to the Cheese Shop.

Windows users will now find my Windows binary eggs on the Cheese Shop PyEphem entry!

Always keep in mind that behind a small triumph like this one for a Free Software developer like myself stands a great mountain-mass of work by hundreds of others in the community. In this case one helpful user lead to one informative blog post which lead to a solid and available tool — MinGW — that is a descendant of the GCC compiler Richard Stallman himself started writing over twenty years ago! All of which allowed the delivery, to a new (and closed) platform, of my Python interface to astronomy routines which Elwood Charles Downey has been maintaining for more than a quarter-century.

this decorates the bottom of the main column this decorates the bottom of the screen

Powered by WordPress