4

I'm using Django 1.2 for Python 2.6 on CentOS 5.5 and I'm trying to install Django Haystack with Xapian as the search backend. I've followed the installation instructions on http://docs.haystacksearch.org/dev/installing_search_engines.html#xapian and also the instructions for the RedHat Enterprise Linux RPM package on http://xapian.org/download. Xapian has installed, but has attached itself to Python 2.4, which needs to be present in CentOS for other reasons. So, if I go into a 'python' shell and 'import xapian' it works correctly, but if I go into a 'python26' shell and 'import xapian' I get the error 'No module named Xapian'.

I then tried creating a symlink in the python 2.6 site packages to Xapian in the python 2.4 site packages and this gave me the following error when trying to import xapian in the python 2.6 shell:
RuntimeWarning: Python C API version mismatch for module _xapian: This Python has API version 1013, module _xapian has version 1012.

I've also tried to specify the python library to use when configuring xapian-core as seen on http://invisibleroads.com/tutorials/xapian-search-pylons.html#install-xapian-on-webfaction, so the command I used was:
./configure PYTHON=/usr/bin/python2.6
then for installing xapian-bindings I used:
./configure PYTHON=/usr/bin/python26 PYTHON_LIB=/usr/lib/python2.6 --with-python
This made no discernible difference so I'm a bit stuck at the moment. Does anyone have any ideas?

hellsgate
  • 5,905
  • 5
  • 32
  • 47
  • have you managed to sort your error out? I have run into the same problem and could use some pointers. – ApPeL Mar 02 '11 at 19:28
  • 1
    @ApPeL: The main problem is that CentOS already has Python2.4 and that is required for the OS to function properly, so installing the python bindings for Xapian installs them for that version by default. You have to make some specifications when you're configuring the Xapian installs, but I can't remember them properly at the moment as it was a colleague who solved this. I'll have a chat with him when I get the chance and I'll post up the solution here. – hellsgate Mar 03 '11 at 12:26
  • that'll be much appreciated. look forward to resolving this – ApPeL Mar 04 '11 at 10:10
  • I know this was awhile ago... but did you ever get the solution to this problem? Are there some parameters to pass in when configuring the make? – GregL83 Aug 30 '11 at 15:23
  • @GregL83: Yes, I did get it solved, but unfortunately I don't know how. Our (then) main sys admin guy was able to do it, but unfortunately he has now moved on to new a new employer and I am unable to find out from him exactly what was done. I know that it was to do with the configure parameters, but more than that I don't know. Sorry! – hellsgate Aug 31 '11 at 12:12

1 Answers1

2

When building the xapian-bindings package you'll want to do ./configure --with-python PYTHON=/usr/bin/python2.6 Sounds like you were trying to do this on xapian-core, which isn't the right place.

Aaron McMillin
  • 2,532
  • 27
  • 42