Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing PyLucene 3.0.3 on Ubuntu 10.04

I'm attempting to install PyLucene 3.0.3 on Ubuntu 10.04. This has proven considerably challenging, but so far I've:

  • Patched setuptools to allow building of JCC, as instructed in the PyLucene docs.
  • Built JCC via: cd pylucene-3.0.3-1/jcc; python setup.py build
  • Built Lucene 3.0.3 via ant, and installed the jar to /usr/share/java/lucene-core-3.0.3-dev.jar. Note, I have Ubuntu's default Lucene package installed to /usr/share/java/lucene-core-2.9.2.jar which also symlinks to /usr/share/java/lucene-core.jar

I'm now trying to "make" PyLucene, but I get the error:

cd lucene-java-3.0.3;  -Dversion=3.0.3
/bin/sh: -Dversion=3.0.3: not found
make: *** [lucene-java-3.0.3/build/lucene-core-3.0.3.jar] Error 127

The file pylucene-3.0.3-1/doc/documentation/install.html makes mention to "edit Makefile to match your environment", but I'm not sure what that means. The makefile seems to contain the same Lucene version number as the one I installed. How else do I need to edit my makefile in order to build PyLucene?

Edit: After uncommenting a section in the makefile (thanks Torsten) for compiling under Ubuntu 8.10 (seriously, 8.10?!) most of it seemed to compile fine, but I still received an error. Several components reported "BUILD SUCCESSFUL" but the final build ended with:

/usr/bin/python -m jcc --shared --jar lucene-java-3.0.3/build/lucene-core-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/snowball/lucene-snowball-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/analyzers/common/lucene-analyzers-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/regex/lucene-regex-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/memory/lucene-memory-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/highlighter/lucene-highlighter-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/queries/lucene-queries-3.0.3.jar --jar build/jar/extensions.jar  --package java.lang java.lang.System java.lang.Runtime --package java.util java.util.Arrays java.text.SimpleDateFormat java.text.DecimalFormat java.text.Collator --package java.io java.io.StringReader java.io.InputStreamReader java.io.FileInputStream --exclude org.apache.lucene.queryParser.Token --exclude org.apache.lucene.queryParser.TokenMgrError --exclude org.apache.lucene.queryParser.QueryParserTokenManager --exclude org.apache.lucene.queryParser.ParseException --exclude org.apache.lucene.search.regex.JakartaRegexpCapabilities --exclude org.apache.regexp.RegexpTunnel --python lucene --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer --version 3.0.3 --module python/collections.py --files 200 --build 
/usr/bin/python: jcc is a package and cannot be directly executed
make: *** [compile] Error 1
like image 493
Cerin Avatar asked Nov 05 '22 00:11

Cerin


1 Answers

I did this before (but without installing Lucene's default package in Ubuntu). I don't know what exactly is Error 127, but in my case it helped to set NUM_FILES=200 from the original NUM_FILES=2 in my Makefile. For some reason when NUM_FILES=2 it creates really huge files in memory which ubuntu will not handle. With NUM_FILES=200 the chunks are smaller and installation worked for me in the end. For python 2.6 you also have to change the JCC setting in Makefile (see below).

Here the part which was important for me in the Makefile:

# Linux     (Ubuntu 8.10 64-bit, Python 2.5.2, OpenJDK 1.6, setuptools 0.6c9)
PREFIX_PYTHON=/usr
ANT=ant
PYTHON=$(PREFIX_PYTHON)/bin/python
JCC=$(PYTHON) -m jcc.__main__ --shared
NUM_FILES=200
like image 106
Torsten Engelbrecht Avatar answered Nov 11 '22 03:11

Torsten Engelbrecht