Title: Building PyLucene URL: pylucene/install.html save_as: pylucene/install.html template: lucene/pylucene/page
PyLucene is completely code-generated by JCC whose sources are included with the PyLucene sources.
To build PyLucene a Java Development Kit is required; use of the resulting PyLucene binaries requires only a Java Runtime Environment (JRE). A recent C/C++ compiler is also required.
Attention: Starting with release 9.x, Lucene requires Java 11 or above.
Attention: Starting with release 6.x, Lucene requires Java 1.8.
On macos and linux, the Temurin JDK is recommended. See “Notes for Linux” at this page for installation instructions on Linux Debian 11.
On any system, if you're upgrading your Java installation, please rebuild JCC as well. You must use the same version of Java for both JCC and PyLucene.
A modern version of setuptools is required for building JCC in shared mode. See JCC's installation instructions for more information.
Before building PyLucene, JCC must be built first. See JCC's installation instructions for building and installing it.
Once JCC is built and installed, PyLucene is built via make which invokes JCC. See PyLucene's Makefile for configuration instructions.
There are limits to both how many files can fit on the command line and how large a C++ file the C++ compiler can handle. By default, JCC generates one large C++ file containing the source code for all wrapper classes.
Using the --files command line argument, this behaviour can be tuned to workaround various limits, for example:
--files 2
--files 10
--files separate
PyLucene's Makefile is a GNU Makefile. Be sure to use gmake instead of plain make.
Just as when building JCC, Python‘s distutils must be nudged a bit to invoke the correct compiler. Sun Studio’s C compiler is called cc while its C++ compiler is called CC.
To build PyLucene, use the following shell command to ensure that the C++ compiler is used:$ CC=CC gmake
PyLucene's Makefile is a GNU Makefile. Be sure to use gmake instead of plain make.
\# Solaris (Solaris 11.1, Python 2.6, 32-bit, Java 1.7) PREFIX_PYTHON=/usr ANT=/usr/bin/ant PYTHON=$(PREFIX_PYTHON)/bin/python JCC=$(PYTHON) -m jcc.\_\_main\_\_ --reserved DEFAULT_TYPE NUM_FILES=4