Home Articles Building TextIndexNG2 binaries for Python 2.4 on Windows
Document Actions

Building TextIndexNG2 binaries for Python 2.4 on Windows

Instruction how to compile binary libraries used by TextIndexNG2 on Windows with Python 2.4 to use in Zope 2.9 or later. Or you can just download them here.

ERROR TextIndexNG Import of Python extensions failed

This is the main reason. I was working on old Zope web application that was recently ported to Zope 2.10. Everything was fine on Linux machine but I couldn't make it to work on my Windows development laptop. I've looked on TextIndexNG on Sourceforge but they only provide binaries (*.pyd files) for Python 2.3. During my search I've found interesting statement from Andreas Jung about support for Windows.

Ultimately I didn't find libraries anywhere. The only choice for me was to compile them myself. Brr... But it was quite simple. If you want you can read this article and do it yourself. Or just download TextIndexNG2 Windows binaries for Python2.4 and use it.

Install MinGW

I don't know much about this. From my point of view it is a C compiler that works on Windows and has worked for me. You can download it from sourceforge.net and read more on mingw.org. If I've manged to install it you can do it too.

Install Python 2.4

I assume that you already have Zope installed and TextIndexNG2 in Products folder. It is also necessary to install Python 2.4. We need it to run setup and compilation. We can't use Python from Zope release because it is not shipped with source files.

Run these commands

Remember to change paths to folders according to what and where you have installed.

  1. Run command line. Usually menu Start->Run
  2. Go to TextIndexNG product
    cd D:\Instances\zope-8080\Products\TextIndexNG2
  3. Add MinGW binaries to Windows PATH for this session.
    set PATH=%PATH%;C:\Program Files\MinGW\bin
  4. Run setup using standalone Python 2.4, not one from Zope
    "C:\Program Files\Python2.4.4\python.exe" setup.py build --compiler=mingw32 install
  5. Copy libraries from build\lib.win32-2.4 to your Zope's site-packages. You should see those 4 files: indexsupport.pyd, Levenshtein.pyd, normalizer.pyd, TXNGSplitter.pyd.
    cd build\lib.win32-2.4
    copy * C:\Program Files\Zope-2.10.5\Python\Lib\site-packages
    

But Where Do You Put the Binaries

Posted by Geoff at 2008-09-05 18:23
But where do you place the binaries if you just download your TextIndexNG2-lib-windows32-python2.4.zip?

Binaries to site-packages

Posted by Lukasz Lakomy at 2008-09-05 18:48
I think point 5 describes in details where to put them.

First you need to unzip them of course. Then copy to:

<ZOPE PATH>\Python\Lib\site-packages (Zope >=2.9)
<ZOPE PATH>\bin\Lib\site-packages (Zope <= 2.8)

I've never tried it but probably if you copy it to your instance's lib folder this should also work.

Sponsor

Advertisements

Tags