Notes from
the Instructor

General installation help: 6:30-8:00PM Tuesday & Wednesday in Open Spaces.

Faster Python Programs through Optimization

Hello

These are important information for all participants from the instructor.
Please read this carefully.

Example Code

Please download the example source code. We will need it in the tutorial.

Required Software

It is essential that you install the needed software before the tutorial. Please do this well in advance at least the day before. There will be no time during the tutorial to do this.

You need:

  • a laptop with the operating system of your choice (Linux, Mac OS X, Windows)
  • Python 2.6 or 2.7 installed
  • RunSnakeRun
  • wxPython needed py RunSnakeRun
  • SquareMap needed py RunSnakeRun
  • the Guppy_PE framework
  • psyco Python 2.6 and 32-bit only, version 1.5.2 or higher)
  • PyPy and
  • NumPy, version 1.2 or higher.

Some of these can be installed with the package manager of your operating system or via pip. Note: psyco is optional and works only for 32-bit systems with Python <= 2.6. Don't install it if your system does not fit this requirments.

Details

More details at the tutorial web page.

Questions

Please ask me if anything needs clarification. mmueller [at] python-academy [dot] de

Mike Müller


Extra notes relevant only to Mac OS 10.7 (Lion) from a user who worked around the problem:

OS/Setup:

Tried to install wxPython with Homebrew, MacPorts, and manual source compile. None of these worked this past weekend. Homebrew and MacPorts are having issues with the new Xcode 4.3 layout. The source code also links to the older layout of Xcode. However, installing the pre-built binary [1] worked. FYI, it had a side-effect of changing permissions in /usr/local, which affected Homebrew.

wxPython explicitly checked to see if the python version being ran was a Framework [2] version. That is, I couldn't create a virtualenv for it and run it that way. I then installed ez_setup.py, pip, squaremap, and runsnakerun [3, 4, 5, 6] against the Framework version. Running python -c 'import wx' worked as expected.

The last issues I had was a Traceback in runsnake [6]. After reading the source, runsnake was looking for an environmental variable called either 'home' or 'appdata'. One of these had to be set to a directory containing a sub-directory called ".config". So prior to executing runsnake, I did a mkdir -p ~/Documents/PyCon/245/.config and set 'appdata' to ~/Documents/PyCon/245. As a final test, I profiled some setup.py and ran runsnake. It worked! [7].

[1] http://downloads.sourceforge.net/wxpython/wxPython2.9-osx-2.9.3.1-cocoa-py2.7.dmg
[2] /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
[3] sudo python ez_setup.py
[4] sudo easy_install pip
[5] sudo pip install squaremap runsnakerun
[6]
...
 File "/Library/Python/2.7/site-packages/runsnakerun/homedirectory.py", line 69, in appdatadirectory
   raise OSError( """Unable to determine user's application-data directory""" )
OSError: Unable to determine user's application-data directory
[7] python -m cProfile -o ${appdata}/test.profile setup.py --help-commands && runsnake ${appdata}/test.profile
community/tutorials/245 Recently modified by stuart: March 7, 2012, 12:10 a.m. (History) Edit