BlogGalleryAbout meContact
Jaganadh's bookshelf: read

Python Text Processing with NTLK 2.0 CookbookPython 2.6 Text Processing Beginners Guide

More of Jaganadh's books »
Jaganadh Gopinadhan's  book recommendations, reviews, quotes, book clubs, book trivia, book lists
Ubuntu GNU/Linux I am nerdier than 94% of all people. Are you a nerd? Click here to take the Nerd Test, get nerdy images and jokes, and write on the nerd forum! Python


Installing PyLucene 3.x in GNU\Linux

"Lucene is a high performance, scalable Information Retrieval (IR) library. It lets you add indexing and searching capabilities to your applications. Lucene is a
mature, free, open-source project implemented in Java; it’s a member of the popular Apache Jakarta family of projects, licensed under the liberal Apache Software License.

" PyLucene is a Python extension for accessing Java Lucene. Its goal is to allow you to use Lucene's text indexing and searching capabilities from Python. It is API compatible with the latest version of Java Lucene, version 2.9.0 as of October 13th, 2009."

I downloaded PyLucene 3.X version and tried to install. Initially I got some error. I was trying to follow the instructions given at There was a confusing statement to me "<edit to match your environment>" :-(. Where to match ?? I scrated my hed for 2 days. Finally I identified the place to edit. Insted of discussinf error I will try to explain how to install PyLucene in GNU\Linux.

Download PyLucene 3.0.0-1 source from .

Extract the source. Now you will be having 'pylucene-3.0.0-1' directory. Change to the directory. Then execute the command "pushd jcc". Now you will be in the jcc directory inside the PyLucene dir. Open the '' file. You have to make some changes in the file to install it properly. In there will be portion like this

    JDK = {
            'darwin': '/System/Library/Frameworks/JavaVM.framework/Versions/Current',
            'ipod': '/usr/include/gcc',
            'linux2': '/usr/lib/jvm/java-1.6.0-openjdk-',
            'sunos5': '/usr/jdk/instances/jdk1.6.0',
            'win32': 'o:/Java/jdk1.6.0_02',
If you are using GNU\Linux you have to change the line "'linux2': '/usr/lib/jvm/java-1.6.0-openjdk-'," . Here you have to specify the path to your Java installation. Here in the example '/usr/lib/jvm/java-1.6.0-openjdk-' is the Java installation path in my system. If you are using M$ windows you have to edit the line "'win32': 'o:/Java/jdk1.6.0_02',".

Now it is time to build and install JCC .
Be superuser and execute the command "python install".
If everything is ok JCC will be installed.

Then execute the command 'popd'. Now you are in the PyLucene source dir again.

In this directory you gave to some editing . Open the 'Makefile'. There will be a portain like this in the file.

"""    #Linux     (Ubuntu 8.10 64-bit, Python 2.5.2, OpenJDK 1.6, setuptools 0.6c9)
    #JCC=$(PYTHON) -m jcc --shared

Uncomment the five lines followed by "#Linux     (Ubuntu 8.10 64-bit, Python 2.5.2, OpenJDK 1.6, setuptools 0.6c9)".
Now the portain should look like
    #Linux     (Ubuntu 8.10 64-bit, Python 2.5.2, OpenJDK 1.6, setuptools 0.6c9)
    JCC=$(PYTHON) -m jcc --shared

If you are using Python 2.6 some more editing to be done. Change the line "JCC=$(PYTHON) -m jcc --shared" to "JCC=$(PYTHON) -m jcc.__main__ --shared".

Run make and make install command. If every setting is PyLucene will be installed in your system. To check your installation rum 'make test' command.

Now enjoy !!!

Happy Hacking!!!!!!!!!!!

Related Entries:
Using Yahoo! Term Extractor web service with Python
Python workshop at Kongu Engineering College, Perundurai
FOSS Workshop at PSR Engineering College Sivakasi
CSV to CouchDB data importing, a Python hack
Book Review: Python 2.6 Text Processing Beginner's Guide by Jeff McNei