You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by "A. Heifets" <ab...@cs.toronto.edu> on 2011/11/03 01:14:44 UTC

NameError: name '_jcc' is not defined

Hello PyLuceners,

The PyLucene make command is failing with the following error:
Traceback (most recent call last):
  File "/usr/lib64/python2.4/site-packages/jcc/__init__.py", line 37, in ?
    _jcc.CLASSPATH = CLASSPATH
NameError: name '_jcc' is not defined
make: *** [compile] Error 1

Any ideas what I'm doing wrong and how I can fix it?

JCC seemed to build without error, and install itself in
/usr/lib64/python2.4/site-packages/jcc, as you can see above.  I
edited the Makefile to contain the following settings:
PREFIX_PYTHON=/usr
ANT=ant
PYTHON=$(PREFIX_PYTHON)/bin/python
#JCC=$(PYTHON) $(PREFIX_PYTHON)/lib/python2.4/site-packages/jcc/__init__.py
JCC=$(PYTHON) $(PREFIX_PYTHON)/lib64/python2.4/site-packages/jcc/__init__.py
NUM_FILES=3

and edited jcc/setup.py to include:
JDK = {
    'linux2': '/usr/lib/jvm/java-1.6.0',#'/usr/lib/jvm/java-6-openjdk',
}

I'm running CentOS:
$ uname -a
Linux foo.local 2.6.18-53.el5 #1 SMP Mon Nov 12 02:14:55 EST 2007
x86_64 x86_64 x86_64 GNU/Linux

with Java 6:
$ yum list installed java\*jdk\*
java-1.6.0-openjdk.x86_64       1:1.6.0.0-1.23.1.9.10.el5_7  installed
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.0-1.23.1.9.10.el5_7  installed

and Python 2.4:
$ yum list installed python\*
python.x86_64                     2.4.3-44.el5               installed
python-devel.i386                 2.4.3-44.el5               installed
python-devel.x86_64               2.4.3-44.el5               installed

Thank you,
Abe

-- 
A. Heifets
http://www.cs.toronto.edu/~aheifets/

Re: NameError: name '_jcc' is not defined

Posted by Andi Vajda <va...@apache.org>.
On Thu, 3 Nov 2011, A. Heifets wrote:

> I got the build working by changing the import line in
> /usr/lib64/python2.4/site-packages/jcc/__init__.py from
>     import os, sys
> to
>     import os, sys, _jcc
>
>
>> That's unexpected. JCC should get installed as an egg. For example, on my
>> system, its installation dir looks like:
>> .../lib/python2.6/site-packages/JCC-2.11-py2.6-macosx-10.6-x86_64.egg
> Hmmm.. I don't have any eggs:
>     $ ls /usr/lib64/python2.4/site-packages/*.egg
>     ls: /usr/lib64/python2.4/site-packages/*.egg: No such file or directory
>
>> Are you using setuptools or just distutils ?
> I followed the directions at
> http://lucene.apache.org/pylucene/jcc/documentation/install.html,
> namely
> 	    $ python setup.py build
> 	    $ sudo python setup.py install

Ok, I can only guess then that you're not using setuptools and that you 
found a bug when distutils only is used.

I'll add the explicit import as you did to work around this issue.

Andi..

Re: NameError: name '_jcc' is not defined

Posted by "A. Heifets" <ab...@cs.toronto.edu>.
I got the build working by changing the import line in
/usr/lib64/python2.4/site-packages/jcc/__init__.py from
     import os, sys
to
     import os, sys, _jcc


> That's unexpected. JCC should get installed as an egg. For example, on my
> system, its installation dir looks like:
> .../lib/python2.6/site-packages/JCC-2.11-py2.6-macosx-10.6-x86_64.egg
Hmmm.. I don't have any eggs:
     $ ls /usr/lib64/python2.4/site-packages/*.egg
     ls: /usr/lib64/python2.4/site-packages/*.egg: No such file or directory

> Are you using setuptools or just distutils ?
I followed the directions at
http://lucene.apache.org/pylucene/jcc/documentation/install.html,
namely
	    $ python setup.py build
	    $ sudo python setup.py install

> Do you have a _jcc.so file in your jcc installation tree somewhere ?
Yes, at /usr/lib64/python2.4/site-packages/jcc/_jcc.so

-- 
A. Heifets
http://www.cs.toronto.edu/~aheifets/

Re: NameError: name '_jcc' is not defined

Posted by Andi Vajda <va...@apache.org>.
On Thu, 3 Nov 2011, A. Heifets wrote:

>> Ok. Why are you using such an old version of Python?
> We have dependencies elsewhere in the system that lock us into 2.4
>
>> Not that I think that's the problem - just curious.
> Any idea what the problem is?  Or what additional diagnostics I can try?

You said:
>> /usr/lib64/python2.4/site-packages/jcc, as you can see above.  I
>> edited the Makefile to contain the following settings:

That's unexpected. JCC should get installed as an egg. For example, on my 
system, its installation dir looks like:
.../lib/python2.6/site-packages/JCC-2.11-py2.6-macosx-10.6-x86_64.egg

Are you using setuptools or just distutils ?

Do you have a _jcc.so file in your jcc installation tree somewhere ?
Have you tried to set a breakpoint at line 35 in that __init__.py file and 
poked around to see what is and is not there ?

For example, for me, I get this:
(Pdb) p _jcc
<module 'jcc._jcc' from '/Users/vajda/apache/pylucene-3.x/_install/lib/python2.6/site-packages/JCC-2.11-py2.6-macosx-10.6-x86_64.egg/jcc/_jcc.so'>

Andi..

Re: NameError: name '_jcc' is not defined

Posted by "A. Heifets" <ab...@cs.toronto.edu>.
> Ok. Why are you using such an old version of Python?
We have dependencies elsewhere in the system that lock us into 2.4

> Not that I think that's the problem - just curious.
Any idea what the problem is?  Or what additional diagnostics I can try?

-- 
A. Heifets
http://www.cs.toronto.edu/~aheifets/

Re: NameError: name '_jcc' is not defined

Posted by Andi Vajda <va...@apache.org>.
On Nov 2, 2011, at 22:17, "A. Heifets" <ab...@cs.toronto.edu> wrote:

> Sorry about that.  I'm using the JCC in the
> pylucene-3.4.0-1-src.tar.gz  distribution downloaded on 2 Nov 2011.

Ok. Why are you using such an old version of Python ? Not that I think that's the problem - just curious.

Andi..

> 
> On Thu, Nov 3, 2011 at 1:05 AM, Andi Vajda <va...@apache.org> wrote:
>> On Nov 2, 2011, at 17:14, "A. Heifets" <ab...@cs.toronto.edu> wrote:
>>> Hello PyLuceners,
>>> 
>>> The PyLucene make command is failing with the following error:
>>> Traceback (most recent call last):
>>>  File "/usr/lib64/python2.4/site-packages/jcc/__init__.py", line 37, in ?
>>>    _jcc.CLASSPATH = CLASSPATH
>>> NameError: name '_jcc' is not defined
>>> make: *** [compile] Error 1
>>> 
>>> Any ideas what I'm doing wrong and how I can fix it?
>> 
>> What version of jcc are you running ?
>> 
>> Andi..
>> 
>>> 
>>> JCC seemed to build without error, and install itself in
>>> /usr/lib64/python2.4/site-packages/jcc, as you can see above.  I
>>> edited the Makefile to contain the following settings:
>>> PREFIX_PYTHON=/usr
>>> ANT=ant
>>> PYTHON=$(PREFIX_PYTHON)/bin/python
>>> #JCC=$(PYTHON) $(PREFIX_PYTHON)/lib/python2.4/site-packages/jcc/__init__.py
>>> JCC=$(PYTHON) $(PREFIX_PYTHON)/lib64/python2.4/site-packages/jcc/__init__.py
>>> NUM_FILES=3
>>> 
>>> and edited jcc/setup.py to include:
>>> JDK = {
>>>    'linux2': '/usr/lib/jvm/java-1.6.0',#'/usr/lib/jvm/java-6-openjdk',
>>> }
>>> 
>>> I'm running CentOS:
>>> $ uname -a
>>> Linux foo.local 2.6.18-53.el5 #1 SMP Mon Nov 12 02:14:55 EST 2007
>>> x86_64 x86_64 x86_64 GNU/Linux
>>> 
>>> with Java 6:
>>> $ yum list installed java\*jdk\*
>>> java-1.6.0-openjdk.x86_64       1:1.6.0.0-1.23.1.9.10.el5_7  installed
>>> java-1.6.0-openjdk-devel.x86_64 1:1.6.0.0-1.23.1.9.10.el5_7  installed
>>> 
>>> and Python 2.4:
>>> $ yum list installed python\*
>>> python.x86_64                     2.4.3-44.el5               installed
>>> python-devel.i386                 2.4.3-44.el5               installed
>>> python-devel.x86_64               2.4.3-44.el5               installed
>>> 
>>> Thank you,
>>> Abe
> 
> -- 
> A. Heifets
> http://www.cs.toronto.edu/~aheifets/

Re: NameError: name '_jcc' is not defined

Posted by "A. Heifets" <ab...@cs.toronto.edu>.
Sorry about that.  I'm using the JCC in the
pylucene-3.4.0-1-src.tar.gz  distribution downloaded on 2 Nov 2011.

On Thu, Nov 3, 2011 at 1:05 AM, Andi Vajda <va...@apache.org> wrote:
> On Nov 2, 2011, at 17:14, "A. Heifets" <ab...@cs.toronto.edu> wrote:
>> Hello PyLuceners,
>>
>> The PyLucene make command is failing with the following error:
>> Traceback (most recent call last):
>>  File "/usr/lib64/python2.4/site-packages/jcc/__init__.py", line 37, in ?
>>    _jcc.CLASSPATH = CLASSPATH
>> NameError: name '_jcc' is not defined
>> make: *** [compile] Error 1
>>
>> Any ideas what I'm doing wrong and how I can fix it?
>
> What version of jcc are you running ?
>
> Andi..
>
>>
>> JCC seemed to build without error, and install itself in
>> /usr/lib64/python2.4/site-packages/jcc, as you can see above.  I
>> edited the Makefile to contain the following settings:
>> PREFIX_PYTHON=/usr
>> ANT=ant
>> PYTHON=$(PREFIX_PYTHON)/bin/python
>> #JCC=$(PYTHON) $(PREFIX_PYTHON)/lib/python2.4/site-packages/jcc/__init__.py
>> JCC=$(PYTHON) $(PREFIX_PYTHON)/lib64/python2.4/site-packages/jcc/__init__.py
>> NUM_FILES=3
>>
>> and edited jcc/setup.py to include:
>> JDK = {
>>    'linux2': '/usr/lib/jvm/java-1.6.0',#'/usr/lib/jvm/java-6-openjdk',
>> }
>>
>> I'm running CentOS:
>> $ uname -a
>> Linux foo.local 2.6.18-53.el5 #1 SMP Mon Nov 12 02:14:55 EST 2007
>> x86_64 x86_64 x86_64 GNU/Linux
>>
>> with Java 6:
>> $ yum list installed java\*jdk\*
>> java-1.6.0-openjdk.x86_64       1:1.6.0.0-1.23.1.9.10.el5_7  installed
>> java-1.6.0-openjdk-devel.x86_64 1:1.6.0.0-1.23.1.9.10.el5_7  installed
>>
>> and Python 2.4:
>> $ yum list installed python\*
>> python.x86_64                     2.4.3-44.el5               installed
>> python-devel.i386                 2.4.3-44.el5               installed
>> python-devel.x86_64               2.4.3-44.el5               installed
>>
>> Thank you,
>> Abe

-- 
A. Heifets
http://www.cs.toronto.edu/~aheifets/

Re: NameError: name '_jcc' is not defined

Posted by Andi Vajda <va...@apache.org>.
On Nov 2, 2011, at 17:14, "A. Heifets" <ab...@cs.toronto.edu> wrote:

> Hello PyLuceners,
> 
> The PyLucene make command is failing with the following error:
> Traceback (most recent call last):
>  File "/usr/lib64/python2.4/site-packages/jcc/__init__.py", line 37, in ?
>    _jcc.CLASSPATH = CLASSPATH
> NameError: name '_jcc' is not defined
> make: *** [compile] Error 1
> 
> Any ideas what I'm doing wrong and how I can fix it?

What version of jcc are you running ?

Andi..

> 
> JCC seemed to build without error, and install itself in
> /usr/lib64/python2.4/site-packages/jcc, as you can see above.  I
> edited the Makefile to contain the following settings:
> PREFIX_PYTHON=/usr
> ANT=ant
> PYTHON=$(PREFIX_PYTHON)/bin/python
> #JCC=$(PYTHON) $(PREFIX_PYTHON)/lib/python2.4/site-packages/jcc/__init__.py
> JCC=$(PYTHON) $(PREFIX_PYTHON)/lib64/python2.4/site-packages/jcc/__init__.py
> NUM_FILES=3
> 
> and edited jcc/setup.py to include:
> JDK = {
>    'linux2': '/usr/lib/jvm/java-1.6.0',#'/usr/lib/jvm/java-6-openjdk',
> }
> 
> I'm running CentOS:
> $ uname -a
> Linux foo.local 2.6.18-53.el5 #1 SMP Mon Nov 12 02:14:55 EST 2007
> x86_64 x86_64 x86_64 GNU/Linux
> 
> with Java 6:
> $ yum list installed java\*jdk\*
> java-1.6.0-openjdk.x86_64       1:1.6.0.0-1.23.1.9.10.el5_7  installed
> java-1.6.0-openjdk-devel.x86_64 1:1.6.0.0-1.23.1.9.10.el5_7  installed
> 
> and Python 2.4:
> $ yum list installed python\*
> python.x86_64                     2.4.3-44.el5               installed
> python-devel.i386                 2.4.3-44.el5               installed
> python-devel.x86_64               2.4.3-44.el5               installed
> 
> Thank you,
> Abe
> 
> -- 
> A. Heifets
> http://www.cs.toronto.edu/~aheifets/