Skip to content

Commit

Permalink
Updated INSTALL.txt and simplified installation
Browse files Browse the repository at this point in the history
  • Loading branch information
romanchyla committed Mar 11, 2015
1 parent 3e20166 commit eb99254
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 227 deletions.
219 changes: 11 additions & 208 deletions INSTALL.txt
Original file line number Diff line number Diff line change
@@ -1,223 +1,26 @@
Pre-requisites:

* Java SDK (v1.7 and newer)
* ant (at least 1.8)
* python (on path, v2.5 and newer)


For the impatient:
Build everything:

<Download MontySolr and extract it>
OR checkout the source
$ git clone [email protected]:romanchyla/montysolr.git montysolr

$ cd montysolr
$ cp build.properties.default build.properties
$ vim build.properties # review the config and set the correct paths
$ ant automatic-install


HOWEVER: this will work only if you already have pre-requisities installed OR if we
built them for you. In any case, give it a try!

The automatic installation will:

* check correct version of Python
* check for JCC module (if available in our repository, we will offer to download and install it for you)
* check pylucene package (again, we'll download and install it if available)
* build the wrapper for Solr (as a Python module)
* build MontySolr (as a Python module)
* run some basic tests



== STANDARD INSTALLATION ==

$ cp build.properties.default build.properties
$ vim build.properties # edit and review the configuration
$ ant examples # downloads solr distro if necessary
# and assembles demo examples
$ ant build-all # compile montysolr (your system must meet
# requirements; see below)
$ ant run # run the demo




== REQUIREMENTS ==

To build MontySolr you need:

* Java JDK >= 1.6 (tested and worked with both OpenJDK and Sun Java JDK)
* ant >= 1.6
* Python >= 2.4 (if you want to take advantage of multiprocessing, then at least Python 2.5)
* setuptools for Python (needed for installation of pylucene)
* JCC module for Python
* PyLucene

If you use automatic installation, you will need only Java and Python. But again, it is
recommended to install the requirements and not rely on our binary packages.


=== JCC ===

http://lucene.apache.org/pylucene/jcc/index.html

JCC is a code generator created by Andi Vajda. It is used to wrap Java into a tiny layer of C++. Thanks to the work
of JCC, we can build Python modules from the Java code. Thanks to JCC we can use Java inside Python, and also
Python inside Java!

JCC must be built in a shared mode (default now). To check it, you can do:

$ python -c "from jcc import config; print 'version=', config.VERSION, ', shared=', config.SHARED"

If shared is not 'True', then you have to rebuilt JCC

$ cd /some/dir/with/jcc
$ export USE_DISTUTILS
$ python setup.py build
$ python setup.py install

-- if you are on Mac OS X, the sequence is: --

$ cd /some/dir/with/jcc
$ export JCC_LFLAGS='-framework:JavaVM:-framework:Python'
$ export USE_DISTUTILS
$ python setup.py build
$ python setup.py install

If your system does not have the correct setup, JCC will warn you and will also provide the instructions on
how to fix it.



=== PYLUCENE ===

http://lucene.apache.org/pylucene

PyLucene is a lucene compiled into a python module (built by JCC).
WARNING: The installed version must match with the version of lucene
present in Solr!

The general installation instructions for pylucene can be found at:

http://lucene.apache.org/pylucene/documentation/install.html


If you use pylucene <3.0.1, you must change the build slightly:


$ set JCCFLAGS= # this is different from the normal setup
$ export JCCFLAGS
$ pushd jcc # standard installation steps...
<edit setup.py to match your environment>
$ python setup.py build
$ sudo python setup.py install
$ popd
<edit Makefile to match your environment>
$ make
$ sudo make install
$ make test # (look for failures)
$ make
$ make install

With this precedure we build pylucene in a shared mode with generics enabled. If
you need to know why, please read on:
$ ant build-all

MontySolr imports pylucene module and other modules built with JCC. When we create
a Java object, the object must have the same signature -- so that we can pass the
same object between solr, lucene and montysolr.

For this to work Pylucene, solr and also montysolr packages must be both built
in a shared mode. Shared mode is default on many recent systems now, but it is
good to check that.

TODO: build a small program that checks shared mode

In MontySolr we also use generics support for Java (this makes your life as Java
programmers much easier in Python). Unfortunately, generics is not yet a default
option. So if you already built a pylucene, you will have to rebuild it again
(in my experience, inclusion of generics does not have a negative impact --
besides you having to work with newer versions of Java, but you do that already,
right?)
If it finished successfuly, you can run the provided example distribution

$ cd ./build/contrib/examples/adsabs
$ ./run.sh

You need to chdir for this example to work properly.


== FAQ ==

Q: What version of Solr shall I use?

You can use both Solr 1.4 and 3.x but make sure that also your PyLucene is the same version, *including minor versions*!
Ie. if your solr is using 2.9.3, then also your pylucene must be 2.9.3.



Q: Do I need a separate distrubution of the lucene sources or is what's in the solr distribution enough?

It is enough. But PyLucene has the lucene jars inside, so inevitably you will end up with two sets
of lucene jars. But this is not a problem. Just make sure that your PyLucene is using the same
version as your Solr instance!




Q: When I start montysolr, I see errors "ImportError: No module named solr_java" ... or "lucene", "foo", "bar" etc.

The message comes from the Python interpreter that cannot find some module. If you installed lucene or
any other into non-standard location, then you have to make that location known to Python.

* use PYTHONPATH
- e.g. "export PYTHONPATH=/some/path:/some/other/path"
* if you start montysolr with ant ("ant run-montysolr")
- edit build.properties
- python_path=/some/path:/some/other/path

If the missing module is "solr_java" then you did not finish installation properly, you can fix it by:

$ ant solr-build

You shall find the solr_java module inside "./montysolr/build/dist" -- from there it can be easily installed.

$ cd ./montysolr/build/dist
$ easy_install solr_java-0.1-py2.6-macosx-10.6-universal.egg




Q: When building the montysolr, I get these errors:

build/_solr_java/__wrap__.cpp: In function �<PyObject* org::apache::solr::search::function::t_DualFloatFunction_createWeight(org::apache::solr::search::function::t_DualFloatFunction*, PyObject*)�>:
build/_solr_java/__wrap__.cpp:2325: error: �<parameters_�> is not a member of �<java::util::t_Map�>

Your PyLucene is not built with the generics support. Please see above how to fix it.



Q: I am using python virtualenv, will it cause problems?

Absolutely no.

Q: Are there any limitations of what I can run inside the Python?

No, if it works in the normal Python session, it will work also inside Solr (provided that you set up correct paths,
have enough memory to host both systems etc.)


Q: I have several versions of Python installed, how to run MontySolr with the non-standard one?

In the past, I was doing something like this:


# first set up environment vars that make your shell to see different Python

$ export LD_LIBRARY_PATH=/opt/rchyla/python26/lib/:/opt/rchyla/python26/lib/python2.6/lib-dynload/
$ export PYTHONHOME=/opt/rchyla/python26/
$ export PYTHONPATH=/opt/rchyla/workspace/:/opt/rchyla/workspace/solrpie/python/
$ export PATH=/opt/rchyla/python26/bin:/opt/rchyla/python26:/afs/cern.ch/user/r/rchyla/public/jdk1.6.0_18/bin/:$PATH

# then use the ant to run MontySolr as a daemon

$ export SOLRPIE_ARGS='--port 8443 --daemon'
$ export SOLRPIE_JVMARGS='-d64 -Xmx2048m -Dsolrpie.max_workers=5 -Dsolrpie.max_threads=200'
$ export SOLRPIE_MAX_WORKERS=5
$ export SOLRPIE_NEWENVIRONMENT=false
$ ant run-solrpie-daemon


Q: MontySolr (Python) fails with ImportError: module x is not available. But I am sure it is available.
Expand Down
9 changes: 3 additions & 6 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
# section of the build.xml file. Be careful to remove trailing whitespaces.


# What version we use, be careful - the version of pylucene must match with
# the lucene version and that one must match with the version of lucene used
# inside solr.

solr.version=4.0.0-SVN
montysolr.version=4.0.0-SVN
# by default, the version will be composed as: <solr-major-version>.<montysolr.version>
# ie. 48.1.0.1
montysolr.version=1.0.0

# if you want to use custom executables; define them here
python=python
Expand Down
9 changes: 3 additions & 6 deletions build.properties.default
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
# section of the build.xml file. Be careful to remove trailing whitespaces.


# What version we use, be careful - the version of pylucene must match with
# the lucene version and that one must match with the version of lucene used
# inside solr.

solr.version=4.0.0-SVN
montysolr.version=4.0.0-SVN
# by default, the version will be composed as: <solr-major-version>.<montysolr.version>
# ie. 48.1.0.1
montysolr.version=1.0.0

# if you want to use custom executables; define them here
python=python
Expand Down
10 changes: 4 additions & 6 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

<property file="build.properties" />


<property name="solr.version" value="48"/>
<property name="solr.home" location="${build.dir}/solr-download/apache-solr-${solr.version}"/>
<property name="webdist.home" location="${webdist}" />
<property name="lib.dir" value="lib" />
<property name="app.name" value="montysolr_java" />
<property name="app.solr.name" value="solr_java" />
<property name="app.version" value="${montysolr.version}" />
<property name="app.version" value="${solr.version}.${montysolr.version}" />
<property name="jar.suffix" value="${app.name}-${app.version}.jar" />
<property name="ddash" value="--" />

Expand Down Expand Up @@ -96,7 +96,6 @@
<condition property="propertiesOK">
<and>
<isset property="montysolr.version" />
<isset property="solr.version" />
</and>
</condition>
</target>
Expand Down Expand Up @@ -146,8 +145,7 @@
message=Automatically generated by ant during compilation of MontySolr, do not change!
solr.home=${solr.home}
solr.real.location=${solr.real.location}
lucene.real.location=${lucene.real.location}
solr.version=${solr.version}
lucene.real.location=${lucene.real.location}
montysolr.version=${montysolr.version}
</echo>

Expand Down Expand Up @@ -280,7 +278,7 @@ montysolr.version=${montysolr.version}

<exec executable="python" failifexecutionfails="true" dir="${solr.home}">
<arg value="-c"/>
<arg value="import os;'${solr.version}'.lower().__contains__('svn') and (os.path.isdir('.svn') and os.system('svn update - -force') or os.system('svn checkout ${solr.svn} .'))"/>
<arg value="import os;'${solr.svn}'.__contains__('svn') and (os.path.isdir('.svn') and os.system('svn update - -force') or os.system('svn checkout ${solr.svn} .'))"/>
</exec>

<antcall target="check-solr-location" />
Expand Down
2 changes: 1 addition & 1 deletion common-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
<attribute name="Implementation-Version"
value="${version} ${svnversion} - ${user.name} - ${DSTAMP} ${TSTAMP}"/>
<attribute name="Implementation-Vendor"
value="CERN"/>
value="ADS"/>
<attribute name="X-Compile-Source-JDK" value="${javac.source}"/>
<attribute name="X-Compile-Target-JDK" value="${javac.target}"/>
</manifest>
Expand Down

0 comments on commit eb99254

Please sign in to comment.