2

I'm trying to install pylucene on python 2.7 (windows) since four days. It requires JCC to build and install. After thousands and thousands different errors I handled myself, at last JCC sucessfully builded and installed. At least, that was what I thought. After that, I tried to import jcc but I get this error:

Traceback (most recent call last):  
    File "<stdin>", line 1, in <module>  
    File "jcc\__init__.py", line 29, in <module>  
      from _jcc import initVM  
ImportError: No module named _jcc  

any ideas? It looks installed perfectly but I can't import it.

msw
  • 42,753
  • 9
  • 87
  • 112
Teoman Unay
  • 21
  • 1
  • 2

4 Answers4

3

Make sure your current dir is not jcc build directory. I get this error if I try to import jcc when in build directory, python uses the wrong jcc then.

petrush
  • 31
  • 2
0

This is going to be tough to answer because there are so many dependencies that to give the question enough context you'd almost have to ship us your machine.

So some questions for you; which are answered best by editing your original question:

  1. This is only about JCC errors? And pylucene is the goal but not part of the problem?
  2. What sort of thousands of errors did you handle yourself? No, I don't want 1000 answers, I'm wondering why it was so difficult for a supported platform.
  3. What version of JCC are you trying to build?

As a wild guess, this line from the JCC installation instructions seems like it could be quite relevant:

Adding the Java directories containing the necessary DLLs and to PATH is a must.

Added in response to comments:

You've gotten yourself into dependency hell for which remote answers are nearly impossible. Just looking at the sheer number of revisions you have to list to describe the work should give you an idea of how many things you have to coordinate.

It's unfortunate, and I've certainly been there myself a couple of times which is why I now do whatever I can to minimize the number of "just outa beta" versions software stacks.

On Ubuntu Lucid, I was able to

$ sudo apt-get install pylucene
$ python 
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
>>> import lucene
>>> dir(lucene)
['AbstractCollection', 'AbstractField', 'AbstractList', ...

But that's last year's PyLucene running on last year's Python. And I don't know lucene so I can't even confirm minimal operation, but presume it is a working PyLucene 2.3.1.

Good luck; you may find that you need to relax your requirements if you want to get it working and remain sane.

msw
  • 42,753
  • 9
  • 87
  • 112
  • First I tried to instal it on Ubuntu and I got shared error they mentioned in the website and there is a patch for it.I tried to patch it and it didn't work. I tried to google it but I couldn't find any useful information. After I restart the computer, it even didn't come with an error msg. Just nothing. I give up on Ubuntu and switched to Windows 7. This time I'm having a problem about a file "vcvarsall.bat" and then found out, it was a compiler error and I tried to build it with MinGW. Now I got a new error msg, MinGW doesn't know about the /LIBPATH command. – Teoman Unay Sep 04 '10 at 13:13
  • Then I looked for that vcversall.bat thing again and I found out Python2.7 doesn't support Visual Studio 2010. I uninstalled VS2010 and Installed VS2008. It worked like a charm. Then I jump to the next step, installing PyLucene. I got an error msg like "we have an error here. you can find the details in compiler output. What compiler output?!? (maybe this one is my ignorance but I couldn't find any output file anywhere) since I couldn't find anything useful,I'm trying to "guess" what's wrong. Just realized,when I try to import jcc,I've got the error msg up here. – Teoman Unay Sep 04 '10 at 13:24
  • Sorry for lots of whining but it's really a frustrating experience. My JCC version is 2.5-py2.7-win32 I'm using Python 2.7 and I'm trying to install pylucene-3.0.0-1. Also I have Visual Studio 8 as I mentioned and jdk1.6.0_21. – Teoman Unay Sep 04 '10 at 13:29
  • You mentioned "Adding the Java directories containing the necessary DLLs and to PATH is a must." -- which directories and DLLs are required? – Paul Dec 03 '10 at 20:14
0

Building pylucene has been a major pain for me too. You may want to have a look at http://code.google.com/a/apache-extras.org/p/pylucene-extra/ - we just started it, and many people seem to have the same issues with the insanely complex build.

The goal is to provide pylucene as pre-built eggs on several operating systems, Python versions and Java runtimes combos.

More eggs will come soon, or please feel free to contribute if you managed to get it working.

Savino Sguera
  • 3,522
  • 21
  • 20
0

I suggest using a pre-built one: Here is the combination that worked for me.

  1. Download JDK 1.6.0_26

  2. Download: lucene-3.1.0-py2.7-win32.egg

  3. Download JCC JCC-2.8-py2.7-win32.egg

  4. Install Java JRE or Java JDK, add C:\Program Files\Java\jdk1.6.0_03\jre\bin\client\ to your path;

  5. Install JCC easy_install JCC-2.8-py2.7-win32.egg

  6. Install PyLucene easy_install lucene-3.1.0-py2.7-win32.egg

  7. Add C:\Python27\Lib\site-packages\JCC-2.8-py2.7-win32.egg\jcc.dll to your path

  8. Test that it is working in the command line python 2.7: python -m jcc

  9. Configure Eclipse IDE to ensure it picks up new libraries. • After Eclipse restarts: • Choose Windows -> Preferences to bring up the preferences dialog. • Change to the PyDev -> Interpreter - Python section to configure Python. • Click on New folder select the 2 new eggs. Pylucene and JCC in c:\Pyton27\Lib\Site-packages\Lucene Etc and JCC- Etc.

By the way when I ported the above which was working using Django Dev server to Apache and Mod_WSGI it no longer worked and I get the same error you got. I ended up successfully using Solr with Sunburnt, which I think is a more scalable solution that works.

Carlos Ferreira
  • 1,980
  • 2
  • 14
  • 18