blob: abf6ec049d09fc418f31c7dcd778f354aa046929 [file] [log] [blame]
<!doctype html>
<html>
<head>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE- 2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link href="/theme/css/lucene/global.css?v=0e493d7a" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta name="Distribution" content="Global"/>
<meta name="Robots" content="index,follow"/>
<script type="text/javascript" src="/theme/javascript/lucene/prototype.js?v=0e493d7a"></script>
<script type="text/javascript" src="/theme/javascript/lucene/effects.js?v=0e493d7a"></script>
<script type="text/javascript" src="/theme/javascript/lucene/slides.js?v=0e493d7a"></script>
<script src="https://www.apachecon.com/event-images/snippet.js"></script> <title>Apache Lucene - Building PyLucene</title>
<meta name="keywords"
content="apache, apache lucene, apache solr, solr, lucene
search, information retrieval, spell checking, faceting, inverted index,
open source"/> <meta property="og:type" content="website" />
<meta property="og:url" content="https://lucene.apache.org/pylucene/install.html"/>
<meta property="og:title" content="Building PyLucene"/>
<meta property="og:description" content="Building PyLucene PyLucene is completely code-generated by JCC whose sources are included with the PyLucene sources. Requirements To..."/>
<meta property="og:image" content="https://lucene.apache.org/theme/images/lucene/lucene_og_image.png?v=0e493d7a"/>
<meta property="og:image:secure_url" content="https://lucene.apache.org/theme/images/lucene/lucene_og_image.png?v=0e493d7a"/>
<link rel="shortcut icon" type="image/png"
href="/theme/images/lucene/lucene-favicon.png?v=0e493d7a"/><link href="/theme/css/lucene/pylucene.css?v=0e493d7a" rel="stylesheet" type="text/css">
</head>
<body id="home">
<div id="wrap">
<div id="header">
<div id="logo" style="float:left">
<a href="/">
<img border="0" src="/theme/images/lucene/lucene_logo_green_300.png?v=0e493d7a" alt="Lucene Logo"/>
</a>
</div>
<!-- TODO: Search disabled as it does not work, 2021-02-21
<div id="search" style="float:right;zoom:1">
<form id="quick-search" method="GET" action="https://sematext.com/opensee/lucene" name="searchform">
<fieldset>
<input type="search" id="q" name="q" placeholder="Search with Apache Solr..." class="class1 class2 hint" accesskey="q">
</fieldset>
</form>
</div>-->
<div id="nav">
<ul>
<li><a href="/pylucene/index.html">PyLucene</a></li>
<li><a href="/pylucene/news.html">News</a></li>
<li><a href="/pylucene/jcc/index.html">JCC</a></li>
<li><a href="https://issues.apache.org/jira/browse/PYLUCENE">Issue Tracker</a></li>
<li><a href="/pylucene/mailing-lists.html">Mailing Lists</a></li>
<li><a class="last" href="/">Lucene TLP</a></li>
</ul>
</div>
</div> <!-- End #header -->
<div id="content-wrap" class="clearfix">
<div id="main">
<div>
<h1 class="title">Building PyLucene</h1>
<h2 id="building-pylucene">Building PyLucene</h2>
<p>PyLucene is completely code-generated by JCC whose sources are included with the
PyLucene sources.</p>
<h2 id="requirements">Requirements</h2>
<p>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.</p>
<p><strong>Attention:</strong> Starting with release 9.x, Lucene requires Java 11 or above.<br/>
<strong>Attention:</strong> Starting with release 6.x, Lucene requires Java 1.8.</p>
<p>On macos and linux, the <a href="https://adoptium.net/">Temurin JDK</a> is recommended.
See "Notes for Linux" at <a href="jcc/install.html">this page</a> for installation instructions on Linux Debian 11.</p>
<p>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.</p>
<p>A modern version of setuptools is required for building JCC in shared mode.
See JCC's <a href="jcc/install.html">installation instructions</a> for more information.</p>
<h2 id="for-the-impatient-ones">For the Impatient Ones</h2>
<ul>
<li><strong>pushd jcc</strong></li>
<li><strong>edit <em>setup.py</em> to match your environment</strong></li>
<li><strong>python setup.py build</strong></li>
<li><strong>sudo python setup.py install</strong></li>
<li><strong>popd</strong></li>
<li><strong>edit <em>Makefile</em> to match your environment</strong></li>
<li><strong>make</strong></li>
<li><strong>make test</strong> (look for failures)</li>
<li><strong>sudo make install</strong></li>
</ul>
<h2 id="for-the-rest-of-us">For the Rest of Us</h2>
<p>Before building PyLucene, JCC must be built first. See JCC's
<a href="jcc/install.html">installation instructions</a> for building and installing it.</p>
<p>Once JCC is built and installed, PyLucene is built via <em>make</em> which invokes JCC.
See PyLucene's <em>Makefile</em> for configuration instructions.</p>
<p>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.</p>
<p>Using the --files command line argument, this behaviour can be tuned to workaround
various limits, for example:</p>
<ul>
<li>to break up the large wrapper class file into about 2 files:<br/><code>--files 2</code></li>
<li>to break up the large wrapper class file into about 10 files:<br/><code>--files 10</code></li>
<li>to generate one C++ file per Java class wrapped:<br/><code>--files separate</code></li>
</ul>
<h2 id="notes-for-solaris-11-with-sun-studio-c-12">Notes for Solaris 11 with Sun Studio C++ 12</h2>
<p>PyLucene's Makefile is a GNU Makefile. Be sure to use <em>gmake</em> instead of plain <em>make</em>.</p>
<p>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 <em>cc</em> while its C++ compiler is
called <em>CC</em>.</p>
<p>To build PyLucene, use the following shell command to ensure that the C++ compiler
is used:<br/><code>$ CC=CC gmake</code></p>
<h2 id="notes-for-solaris-111-with-gcc-45">Notes for Solaris 11.1 with GCC 4.5</h2>
<p>PyLucene's Makefile is a GNU Makefile. Be sure to use gmake instead of plain make.</p>
<ul>
<li>Edit Makefile and do the following changes: Insert and enable a Solaris-Section
with the following content</li>
</ul>
<div class="highlight"><pre><span></span><code><span class="err">\# Solaris (Solaris 11.1, Python 2.6, 32-bit, Java 1.7)</span>
<span class="err">PREFIX_PYTHON=/usr</span>
<span class="err">ANT=/usr/bin/ant</span>
<span class="err">PYTHON=$(PREFIX_PYTHON)/bin/python</span>
<span class="err">JCC=$(PYTHON) -m jcc.\_\_main\_\_ --reserved DEFAULT_TYPE</span>
<span class="err">NUM_FILES=4</span>
</code></pre></div>
<ul>
<li>gmake</li>
<li>su gmake install</li>
</ul>
</div>
</div>
<div id="sidebar">
<div class="button-wrapper" style="margin-top: 40px;">
<div class="button-green">
<a href="https://www.apache.org/dyn/closer.lua/lucene/pylucene/">Download</a>
<div class="flap top">Click to begin</div>
<div class="flap bottom">of Apache PyLucene</div>
</div>
</div>
<h1 id="documentation">Documentation<a class="headerlink" href="#documentation" title="Permanent link"></a></h1>
<ul>
<li><a href="https://www.apache.org/licenses/">License</a></li>
<li><a href="/pylucene/features.html">Features</a></li>
<li><a href="/pylucene/install.html">Install</a></li>
</ul>
<h1 id="events">Events<a class="headerlink" href="#events" title="Permanent link"></a></h1>
<ul>
<a class="acevent" data-format="square" data-mode="light" data-width="160" data-style="border: 1px solid lightgrey"></a>
</ul>
<h1 id="asf-links">ASF links<a class="headerlink" href="#asf-links" title="Permanent link"></a></h1>
<ul>
<li><a href="https://www.apache.org">Apache Software Foundation</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
<li><a href="https://www.apache.org/security/">Security</a></li>
</ul>
<h1 id="related-projects">Related Projects<a class="headerlink" href="#related-projects" title="Permanent link"></a></h1>
<ul>
<li><a href="https://solr.apache.org">Apache Solr</a></li>
<li><a href="http://hadoop.apache.org">Apache Hadoop</a></li>
<li><a href="http://manifoldcf.apache.org/">Apache ManifoldCF</a></li>
<li><a href="http://lucenenet.apache.org/">Apache Lucene.Net</a></li>
<li><a href="http://mahout.apache.org">Apache Mahout</a></li>
<li><a href="http://nutch.apache.org">Apache Nutch</a></li>
<li><a href="http://opennlp.apache.org/">Apache OpenNLP</a></li>
<li><a href="http://tika.apache.org">Apache Tika</a></li>
<li><a href="http://zookeeper.apache.org">Apache Zookeeper</a></li>
</ul> </div>
</div> <!-- End #content-wrap -->
<div id="footer">
<div class="copyright">
<p>
Copyright &copy; 2011-2024 The Apache Software Foundation, Licensed under
the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>. <a href="/privacy.html">Privacy Policy</a> <br/>
Apache and the Apache feather logo are trademarks of The Apache Software Foundation. Apache Lucene, Apache Solr and their
respective logos are trademarks of the Apache Software Foundation. Please see the <a href="https://www.apache.org/foundation/marks/">Apache Trademark Policy</a>
for more information.
</p>
</div>
</div> </div> <!-- End #wrap -->
</body>
</html>