davidrickard.net

Random stuff, randomly updated.

Cheetah, Namemapper, and ‘the docs don’t say that’.

You may find this useful (I did).

If you’re installing the Python Cheetah library, you’ll most likely follow the instructions, which say to do the following:

To install Cheetah in your system-wide Python library:

  1. Login as a user with privileges to install system-wide Python packages. On POSIX systems (AIX, Solaris, Linux, IRIX, etc.), the command is normally ‘su root’. On non-POSIX systems such as Windows NT, login as an administrator.
  2. Run python setup.py install at the command prompt.
  3. The setup program will install the wrapper script cheetah to wherever it usually puts Python binaries ("/usr/bin/", "bin/" in the Python install directory, etc.)

Quite simple. However, what it neglects to mention is that there is a little module within the library called ‘namemapper’. What it does, I don’t entirely know (something to do with mapping names would be my guess), but this module is written in C. Simply running the install as per the Cheetah docs won’t build this module, which results in much slower performance from Cheetah overall as it falls back to a python-based internal equivalent. However, if you run the command python setup.py build BEFORE the install command, it will happily compile said module. The install will then install it along with everything else, and all is well. Obviously you need gcc installed to do this (I had the dev pattern installed on my OpenSuSE box).

Why the docs don’t mention this, I don’t know. Still, nice to know there’s a simple fix.

One Response to “Cheetah, Namemapper, and ‘the docs don’t say that’.”

  • Thanks for the tips I was having problems installing the same module.