lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <va...@apache.org>
Subject Re: installation fails : python class name already in use
Date Tue, 30 Apr 2013 14:45:22 GMT

On Apr 30, 2013, at 0:46, Helmut Jarausch <jarausch@igpm.rwth-aachen.de> wrote:

> On 04/29/2013 04:52:00 PM, Andi Vajda wrote:
>> On Apr 29, 2013, at 5:36, Helmut Jarausch <jarausch@igpm.rwth-aachen.de> wrote:
>> > On 04/27/2013 08:25:04 PM, Andi Vajda wrote:
>> >> Hi Helmut,
>> >> On Sat, 27 Apr 2013, Helmut Jarausch wrote:
>> >>> Hi,
>> >>> after a long time I'm in need to reinstall pylucene on my Gentoo system.
>> >>> Here, Lucene-3.5.0, oracle-jdk-bin-1.7.0.21 and Python-2.7.4 is installed.
>> >>> I fetched the pylucene_3_5 branch of svn.apache.org/repos/asf/lucene/pylucene/
>> >>> Patching setuptools and installing jcc did work.
>> >>> But trying to build pylucene itself fails with:
>> >>> Traceback (most recent call last):
>> >>> File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
>> >>>  "__main__", fname, loader, pkg_name)
>> >>> File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
>> >>>  exec code in run_globals
>> >>> File "/usr/lib64/python2.7/site-packages/JCC-2.16-py2.7-linux-x86_64.egg/jcc/__main__.py",
line 107, in <module>
>> >>>  cpp.jcc(sys.argv)
>> >>> File "/usr/lib64/python2.7/site-packages/JCC-2.16-py2.7-linux-x86_64.egg/jcc/cpp.py",
line 655, in jcc
>> >>>  raise ValueError, (cls, 'python class name already in use, use --rename',
name, pythonNames[name])
>> >>> ValueError: (<Class: class org.apache.lucene.analysis.nl.DutchStemmer>,
'python class name already in use, use --rename', u'DutchStemmer', <Class: class org.tartarus.snowball.ext.DutchStemmer>)
>> >>> In addition there were some warnings:
>> >>> Warning: renaming static method 'toString' on class java.lang.Byte to
'toString_' since it is shadowed by non-static method of same name.
>> >>> Warning: renaming static method 'getCurrentSegmentFileName' on class
org.apache.lucene.index.SegmentInfos to 'getCurrentSegmentFileName_' since it is shadowed
by non-static method of same name.
>> >>> Warning: renaming static method 'toString' on class java.lang.Boolean
to 'toString_' since it is shadowed by non-static method of same name.
>> >>> Warning: renaming static method 'foldToASCII' on class org.apache.lucene.analysis.ASCIIFoldingFilter
to 'foldToASCII_' since it is shadowed by non-static method of same name.
>> >>> Warning: renaming static method 'copy' on class org.apache.lucene.store.Directory
to 'copy_' since it is shadowed by non-static method of same name.
>> >>> Warning: renaming static method 'toString' on class java.lang.Long to
'toString_' since it is shadowed by non-static method of same name.
>> >>> What am I missing?
>> >> The answer is in the error message:
>> >>  ValueError: (<Class: class org.apache.lucene.analysis.nl.DutchStemmer>,
>> >>  'python class name already in use, use --rename', u'DutchStemmer', <Class:
>> >>  class org.tartarus.snowball.ext.DutchStemmer>)
>> >> There are two classes named DutchStemmer and one must be wrapped with a
renamed Python wrapper so as to not clash with the other. There several other cases of this
in the PyLucene Makefile and you should use them as
>> >> examples:
>> >>  --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer
>> >> Pick another name for the second DutchStemmer Python wrapper class (as in
the example above and add this as a --rename line to the other ones in the Makefile.
>> >> This situation is fixed in the upcoming PyLucene 4.3 release where JCC
>> >> emits a complete package hierarchy and classes stay in their namespaces,
no longer clashing.
>> >> As to the other warnings, they are just warnings. They matter if you want
to call these methods.
>> >> Andi..
>> >
>> > Thanks Andi,
>> >
>> > I've added a few --rename lines and now it fails with
>> >  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
>> >    "__main__", fname, loader, pkg_name)
>> >  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
>> >    exec code in run_globals
>> >  File "/usr/lib64/python2.7/site-packages/JCC-2.16-py2.7-linux-x86_64.egg/jcc/__main__.py",
line 107, in <module>
>> >    cpp.jcc(sys.argv)
>> >  File "/usr/lib64/python2.7/site-packages/JCC-2.16-py2.7-linux-x86_64.egg/jcc/cpp.py",
line 455, in jcc
>> >    for arg in args[i].split(',')]))
>> > ValueError: dictionary update sequence element #0 has length 1; 2 is required
>> > make: *** [compile] Error 1
>> Please include the lines you added here so that I can I help you debug this.
> 
> Please see the diff at the end of this email.
> 
> 
>> Did you end all lines with \ ?
>> > Can I use most recent version (SVN?) if I have dev-java/lucene-3.5.0 installed
here?
>> Most recent version of what ?
>> JCC ? or both ?
>> Either way, yes, although trunk is based on the upcoming lucene 4.3 relea
>> se and has a different API from lucene 3.x so you need to migrate your application
code using PyLucene to the new API.
>> Andi..
> 
> Sorry, but I don't understand this. If trunk PyLucene expects a new Lucene API how can
it work with Lucene-3.5.0 which still has
> the old API ?
> 
> Many thanks,
> Andi,
> Helmut.
> 
> Here the diff of the original Makefile to my modified version:
> 
> --- Makefile.orig       2013-04-27 10:23:03.743234395 +0200
> +++ Makefile    2013-04-29 14:26:04.862309465 +0200
> @@ -102,11 +102,11 @@
> #NUM_FILES=4
> 
> # 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 --shared
> -#NUM_FILES=4
> +PREFIX_PYTHON=/usr
> +ANT=ant
> +PYTHON=$(PREFIX_PYTHON)/bin/python
> +JCC=$(PYTHON) -m jcc --shared
> +NUM_FILES=1
> 
> # FreeBSD
> #PREFIX_PYTHON=/usr
> @@ -296,6 +296,11 @@
>            --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;'
\
>            --sequence java.util.AbstractList 'size:()I' 'get:(I)Ljava/lang/Object;' \
>            --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer
\
> +           --rename org.apache.lucene.analysis.nl.DutchStemmer=DutchStemmerOther \
> +           --rename org.apache.lucene.analysis.nl.GermanStemmer=GermanStemmerOther \
> +           --rename org.apache.lucene.analysis.nl.FrenchStemmer=FrenchStemmerOther \

There's a french stemmer in the 'nl' package ?

> +           --rename org.apache.lucene.queryParser.CharStream=CharStream2 \
> +           --rename class

What's that 'class' word doing there ?

> org.apache.lucene.search.Scorer=Scorer \
>            --version $(LUCENE_VER) \
>            --module python/collections.py \
>            --module python/ICUNormalizer2Filter.py \
> 68

Mime
View raw message