Installing wxPython 2.8 on Debian Lenny

Actually Debian has the python-wxgtk2.8 package which you can simply apt-get if you wish to have it installed as part of Python 2.5 which is the stable version for Lenny.  I’m adding wxPython 2.8 to Python 2.6, which I installed from source.

I mostly followed what the official wxPython installation guide says.  It was not a smooth installation for me, so this is my own installation note.  The version is

First, download the tarball for wxPython from the official repository.  Here I assume the archive is downloaded to /usr/local/src/wx.

Some libraries need to be installed since wxWidgets will be built against them:

$ sudo apt-get install libgtk2.0-dev libglu1-mesa-dev

You need to first build wxWidgets, and then build extension module for wxPython.  Anyways, decompress and untar, and create a working directory for building wxWidgets:

$ bunzip2 -c wxPython-src- | tar xvf -
$ cd wxPython-src-
$ mkdir bld
$ cd bld

In the bld directory, create a file named .configure with the following content:

../configure \
 --prefix=/usr/local/lib/wx/2.8 \
 --with-gtk \
 --with-gnomeprint \
 --with-opengl \
 --with-libjpeg=builtin \
 --with-libpng=builtin \
 --with-libtiff=builtin \
 --with-zlib=builtin \
 --enable-optimize \
 --enable-geometry \
 --enable-graphics_ctx \
 --enable-sound --with-sdl \
 --enable-mediactrl \
 --enable-display \
 --enable-unicode \

Here I am assuming the newly build wxWidgets library will be installed under /usr/local/lib/wx/2.8.  You may change the installation location, of course.  For details on what these switches will do, refer to the official installation guide for wxPython.

Create a file named .make with the following content:

make $* && make -C contrib/src/gizmos $* && make -C contrib/src/stc $*

Give both the files an executable permision, and do the usual thing:

$ chmod +x .configure
$ chmod +x .make
$ ./.configure


$ ./.make
$ sudo ./.make install

If this process ends without errors, you are ready to install wxPython. Before you run, however, you need to patch a source file.  Download this diff file to the top installation directory (i.e., wxPython-src- and run the patch:

$ cd ..
$ wget
$ patch -p0 < wxpython28101_gdiwrap.diff

After the patch is applied correctly, move to wxPython directory:

$ cd wxPython

Now, in, you need to find the line that starts with WX_CONFIG and set the variable to the path to wx-config script, /usr/local/lib/wx/2.8/bin/wx-config in our case:

WX_CONFIG = '/usr/local/lib/wx/2.8/bin/wx-config'

Then finally install the wxPython package:

$ python2.6 build_ext --inplace
$ sudo python2.6 install

Here I’m running as a Python 2.6 script since I want to install wx into the site-packages directory for Python 2.6.

$ python2.6
$ import wx

If this gives no ImportError, it is a success.  If you receive an error, check the permission of wx.pth undersite-packages; the file must be world readable (i.e., 644).

To avoid ImportError upon importing wx in Python, you need to add the following line in ~/.bashrc (or ~/.bash_profile):

export LD_LIBRARY_PATH=/usr/local/lib/wx/2.8/lib:${LD_LIBRARY_PATH}

That’s it.  Make sure “import wx” works under python2.6.  If not, well…


I want to have wx loaded without specifying LD_LIBRARY_PATH.  Using the –enable-rpath option is supposed to do this, but it apparently doesn’t for me.

This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

6 Responses to Installing wxPython 2.8 on Debian Lenny

  1. Pingback: Installing wxPython 2.8 on Debian Lenny | - Your one stop for news about Debian

  2. Pingback: Installing NumPy, SciPy, & Matplotlib on Debian Lenny (AMD64) with Python 2.6 « Biboroku

  3. Pingback: Installing NumPy, SciPy, & Matplotlib on Debian Lenny (AMD64) with Python 2.6 | Biboroku

  4. Vladimir says:

    Hi, thanks a lot for this guide, it’s very helpful.
    Just wanted to note that:


    should be spelled as


  5. Liam Gretton says:

    The LD_LIBRARY_PATH issue can be fixed by hacking wx-config (pending a proper fix from the author).

    Add the following line near the start:


Leave a Reply

Your email address will not be published. Required fields are marked *