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 Jiang Fung Wong <ji...@jamiq.com> on 2011/11/08 07:28:46 UTC
ImportError: DLL load failed: The specified module could not be found.
Dear All,
I got this error when trying to import pylucene inside Postgres PL/Python.
ERROR: ('Traceback (most recent call last):
File "<string>", line 17, in __plpython_procedure_testing_1517611
File "d:\\ve\\Lib\\site-packages\\lucene-3.4.0-py2.6-win32.egg\\lucene\\__init__.py",
line 5, in <module>
import jcc, _lucene
File "d:\\ve\\Lib\\site-packages\\jcc-2.11-py2.6-win32.egg\\jcc\\__init__.py",
line 34, in <module>
from _jcc import initVM
ImportError: DLL load failed: The specified module could not be found.
',)
I have no isue importing jvm.dll using ctypes, ctypes.windll.LoadLibrary("jvm")
The path to jvm.dll is also listed on the PATH environment variable,
from the output of the statement plpy.info(os.environ['Path']) below.
I have no problem importing pylucene on my system's python
interpretor, outside Postgres.
How to solve this?
Here's my code:
drop function testing();
CREATE FUNCTION testing()
RETURNS text
AS $$
import os
import ctypes
ctypes.windll.LoadLibrary("jvm")
plpy.info(os.environ['Path'])
try:
import lucene
except Exception, e:
import traceback
plpy.error(traceback.format_exc())
else:
return ""
$$ LANGUAGE plpythonu;
Re: ImportError: DLL load failed: The specified module could not be found.
Posted by Jiang Fung Wong <ji...@jamiq.com>.
I have isolated the problem.
The following gives an error
drop function testing();
CREATE FUNCTION testing()
RETURNS text
AS $$
import ctypes
try:
ctypes.windll.LoadLibrary("D:\\jcc.dll")
except:
import traceback
plpy.error(traceback.format_exc())
return ''
$$ LANGUAGE plpythonu;
select testing();
The following does not:
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.windll.LoadLibrary("D:\\jcc.dll")
<WinDLL 'D:\jcc.dll', handle 410000 at 1d9cb10>
>>>
It has something to do with Postgres. I am asking them on their IRC channel.
On Tue, Nov 8, 2011 at 5:05 PM, Jiang Fung Wong
<ji...@jamiq.com> wrote:
> On Tue, Nov 8, 2011 at 4:20 PM, Andi Vajda <va...@apache.org> wrote:
>>
>> On Nov 8, 2011, at 0:08, Jiang Fung Wong <ji...@jamiq.com> wrote:
>>
>>> I have added the directory containing jcc.dll, which is the jcc egg,
>>> to PATH. It is not necessary, because the code in jcc\__init__.py
>>> automatically adds the directory to PATH. Anyway I have added it, and
>>> the result is the same.
>>
>> Then it could be that a DLL that _jcc.dll depends on was not found or could not otherwise be loaded.
>>
>> Is there a Java VM embedded in the Postgres process ? If so, is it the same that was used to build PyLucene ?
>>
>> Andi..
>>
>
> I don't see how it turns out this way. Because I am able to use
> pyLucene on the python interpretor outside postgres.
> Theoretically they share the same system PATH environment variable, so
> both of them should import without problem, or both of them have the
> same problem. Is there a way I can do some debugging?
>
> There is no JavaVM embedded in postgres.
>
> -JF
>
>>>
>>> I couldn't not import lucene module, so there is way to run initVM().
>>>
>>> I can run pyLucene in Python 2.6.4, and the postgres' python is also 2.6.4
>>>
>>> On Tue, Nov 8, 2011 at 2:57 PM, Andi Vajda <va...@apache.org> wrote:
>>>>
>>>> On Nov 7, 2011, at 22:28, Jiang Fung Wong <ji...@jamiq.com> wrote:
>>>>
>>>>> Dear All,
>>>>>
>>>>> I got this error when trying to import pylucene inside Postgres PL/Python.
>>>>>
>>>>> ERROR: ('Traceback (most recent call last):
>>>>> File "<string>", line 17, in __plpython_procedure_testing_1517611
>>>>> File "d:\\ve\\Lib\\site-packages\\lucene-3.4.0-py2.6-win32.egg\\lucene\\__init__.py",
>>>>> line 5, in <module>
>>>>> import jcc, _lucene
>>>>> File "d:\\ve\\Lib\\site-packages\\jcc-2.11-py2.6-win32.egg\\jcc\\__init__.py",
>>>>> line 34, in <module>
>>>>> from _jcc import initVM
>>>>> ImportError: DLL load failed: The specified module could not be found.
>>>>> ',)
>>>>>
>>>>> I have no isue importing jvm.dll using ctypes, ctypes.windll.LoadLibrary("jvm")
>>>>> The path to jvm.dll is also listed on the PATH environment variable,
>>>>> from the output of the statement plpy.info(os.environ['Path']) below.
>>>>> I have no problem importing pylucene on my system's python
>>>>> interpretor, outside Postgres.
>>>>>
>>>>> How to solve this?
>>>>
>>>> You probably need to set some PATH environment variable to contain the directory that contains the _jcc.dll for the process Postgres is running in.
>>>> A Postgres windows user mailing list may have more details for you.
>>>> Don't forget that you also must run initVM() from the process' main thread and that each thread calling into PyLucene must call attachCurrentThread() too.
>>>>
>>>> Last but not least, is the version of Python embedded in Postgres the same as the one you used to build PyLucene ?
>>>>
>>>> Andi..
>>>>
>>>>>
>>>>> Here's my code:
>>>>>
>>>>> drop function testing();
>>>>> CREATE FUNCTION testing()
>>>>> RETURNS text
>>>>> AS $$
>>>>>
>>>>> import os
>>>>> import ctypes
>>>>> ctypes.windll.LoadLibrary("jvm")
>>>>> plpy.info(os.environ['Path'])
>>>>>
>>>>> try:
>>>>> import lucene
>>>>> except Exception, e:
>>>>> import traceback
>>>>> plpy.error(traceback.format_exc())
>>>>> else:
>>>>> return ""
>>>>>
>>>>> $$ LANGUAGE plpythonu;
>>>>
>>
>
Re: ImportError: DLL load failed: The specified module could not be found.
Posted by Jiang Fung Wong <ji...@jamiq.com>.
On Tue, Nov 8, 2011 at 4:20 PM, Andi Vajda <va...@apache.org> wrote:
>
> On Nov 8, 2011, at 0:08, Jiang Fung Wong <ji...@jamiq.com> wrote:
>
>> I have added the directory containing jcc.dll, which is the jcc egg,
>> to PATH. It is not necessary, because the code in jcc\__init__.py
>> automatically adds the directory to PATH. Anyway I have added it, and
>> the result is the same.
>
> Then it could be that a DLL that _jcc.dll depends on was not found or could not otherwise be loaded.
>
> Is there a Java VM embedded in the Postgres process ? If so, is it the same that was used to build PyLucene ?
>
> Andi..
>
I don't see how it turns out this way. Because I am able to use
pyLucene on the python interpretor outside postgres.
Theoretically they share the same system PATH environment variable, so
both of them should import without problem, or both of them have the
same problem. Is there a way I can do some debugging?
There is no JavaVM embedded in postgres.
-JF
>>
>> I couldn't not import lucene module, so there is way to run initVM().
>>
>> I can run pyLucene in Python 2.6.4, and the postgres' python is also 2.6.4
>>
>> On Tue, Nov 8, 2011 at 2:57 PM, Andi Vajda <va...@apache.org> wrote:
>>>
>>> On Nov 7, 2011, at 22:28, Jiang Fung Wong <ji...@jamiq.com> wrote:
>>>
>>>> Dear All,
>>>>
>>>> I got this error when trying to import pylucene inside Postgres PL/Python.
>>>>
>>>> ERROR: ('Traceback (most recent call last):
>>>> File "<string>", line 17, in __plpython_procedure_testing_1517611
>>>> File "d:\\ve\\Lib\\site-packages\\lucene-3.4.0-py2.6-win32.egg\\lucene\\__init__.py",
>>>> line 5, in <module>
>>>> import jcc, _lucene
>>>> File "d:\\ve\\Lib\\site-packages\\jcc-2.11-py2.6-win32.egg\\jcc\\__init__.py",
>>>> line 34, in <module>
>>>> from _jcc import initVM
>>>> ImportError: DLL load failed: The specified module could not be found.
>>>> ',)
>>>>
>>>> I have no isue importing jvm.dll using ctypes, ctypes.windll.LoadLibrary("jvm")
>>>> The path to jvm.dll is also listed on the PATH environment variable,
>>>> from the output of the statement plpy.info(os.environ['Path']) below.
>>>> I have no problem importing pylucene on my system's python
>>>> interpretor, outside Postgres.
>>>>
>>>> How to solve this?
>>>
>>> You probably need to set some PATH environment variable to contain the directory that contains the _jcc.dll for the process Postgres is running in.
>>> A Postgres windows user mailing list may have more details for you.
>>> Don't forget that you also must run initVM() from the process' main thread and that each thread calling into PyLucene must call attachCurrentThread() too.
>>>
>>> Last but not least, is the version of Python embedded in Postgres the same as the one you used to build PyLucene ?
>>>
>>> Andi..
>>>
>>>>
>>>> Here's my code:
>>>>
>>>> drop function testing();
>>>> CREATE FUNCTION testing()
>>>> RETURNS text
>>>> AS $$
>>>>
>>>> import os
>>>> import ctypes
>>>> ctypes.windll.LoadLibrary("jvm")
>>>> plpy.info(os.environ['Path'])
>>>>
>>>> try:
>>>> import lucene
>>>> except Exception, e:
>>>> import traceback
>>>> plpy.error(traceback.format_exc())
>>>> else:
>>>> return ""
>>>>
>>>> $$ LANGUAGE plpythonu;
>>>
>
Re: ImportError: DLL load failed: The specified module could not be found.
Posted by Andi Vajda <va...@apache.org>.
On Nov 8, 2011, at 0:08, Jiang Fung Wong <ji...@jamiq.com> wrote:
> I have added the directory containing jcc.dll, which is the jcc egg,
> to PATH. It is not necessary, because the code in jcc\__init__.py
> automatically adds the directory to PATH. Anyway I have added it, and
> the result is the same.
Then it could be that a DLL that _jcc.dll depends on was not found or could not otherwise be loaded.
Is there a Java VM embedded in the Postgres process ? If so, is it the same that was used to build PyLucene ?
Andi..
>
> I couldn't not import lucene module, so there is way to run initVM().
>
> I can run pyLucene in Python 2.6.4, and the postgres' python is also 2.6.4
>
> On Tue, Nov 8, 2011 at 2:57 PM, Andi Vajda <va...@apache.org> wrote:
>>
>> On Nov 7, 2011, at 22:28, Jiang Fung Wong <ji...@jamiq.com> wrote:
>>
>>> Dear All,
>>>
>>> I got this error when trying to import pylucene inside Postgres PL/Python.
>>>
>>> ERROR: ('Traceback (most recent call last):
>>> File "<string>", line 17, in __plpython_procedure_testing_1517611
>>> File "d:\\ve\\Lib\\site-packages\\lucene-3.4.0-py2.6-win32.egg\\lucene\\__init__.py",
>>> line 5, in <module>
>>> import jcc, _lucene
>>> File "d:\\ve\\Lib\\site-packages\\jcc-2.11-py2.6-win32.egg\\jcc\\__init__.py",
>>> line 34, in <module>
>>> from _jcc import initVM
>>> ImportError: DLL load failed: The specified module could not be found.
>>> ',)
>>>
>>> I have no isue importing jvm.dll using ctypes, ctypes.windll.LoadLibrary("jvm")
>>> The path to jvm.dll is also listed on the PATH environment variable,
>>> from the output of the statement plpy.info(os.environ['Path']) below.
>>> I have no problem importing pylucene on my system's python
>>> interpretor, outside Postgres.
>>>
>>> How to solve this?
>>
>> You probably need to set some PATH environment variable to contain the directory that contains the _jcc.dll for the process Postgres is running in.
>> A Postgres windows user mailing list may have more details for you.
>> Don't forget that you also must run initVM() from the process' main thread and that each thread calling into PyLucene must call attachCurrentThread() too.
>>
>> Last but not least, is the version of Python embedded in Postgres the same as the one you used to build PyLucene ?
>>
>> Andi..
>>
>>>
>>> Here's my code:
>>>
>>> drop function testing();
>>> CREATE FUNCTION testing()
>>> RETURNS text
>>> AS $$
>>>
>>> import os
>>> import ctypes
>>> ctypes.windll.LoadLibrary("jvm")
>>> plpy.info(os.environ['Path'])
>>>
>>> try:
>>> import lucene
>>> except Exception, e:
>>> import traceback
>>> plpy.error(traceback.format_exc())
>>> else:
>>> return ""
>>>
>>> $$ LANGUAGE plpythonu;
>>
Re: ImportError: DLL load failed: The specified module could not be found.
Posted by Jiang Fung Wong <ji...@jamiq.com>.
I have added the directory containing jcc.dll, which is the jcc egg,
to PATH. It is not necessary, because the code in jcc\__init__.py
automatically adds the directory to PATH. Anyway I have added it, and
the result is the same.
I couldn't not import lucene module, so there is way to run initVM().
I can run pyLucene in Python 2.6.4, and the postgres' python is also 2.6.4
On Tue, Nov 8, 2011 at 2:57 PM, Andi Vajda <va...@apache.org> wrote:
>
> On Nov 7, 2011, at 22:28, Jiang Fung Wong <ji...@jamiq.com> wrote:
>
>> Dear All,
>>
>> I got this error when trying to import pylucene inside Postgres PL/Python.
>>
>> ERROR: ('Traceback (most recent call last):
>> File "<string>", line 17, in __plpython_procedure_testing_1517611
>> File "d:\\ve\\Lib\\site-packages\\lucene-3.4.0-py2.6-win32.egg\\lucene\\__init__.py",
>> line 5, in <module>
>> import jcc, _lucene
>> File "d:\\ve\\Lib\\site-packages\\jcc-2.11-py2.6-win32.egg\\jcc\\__init__.py",
>> line 34, in <module>
>> from _jcc import initVM
>> ImportError: DLL load failed: The specified module could not be found.
>> ',)
>>
>> I have no isue importing jvm.dll using ctypes, ctypes.windll.LoadLibrary("jvm")
>> The path to jvm.dll is also listed on the PATH environment variable,
>> from the output of the statement plpy.info(os.environ['Path']) below.
>> I have no problem importing pylucene on my system's python
>> interpretor, outside Postgres.
>>
>> How to solve this?
>
> You probably need to set some PATH environment variable to contain the directory that contains the _jcc.dll for the process Postgres is running in.
> A Postgres windows user mailing list may have more details for you.
> Don't forget that you also must run initVM() from the process' main thread and that each thread calling into PyLucene must call attachCurrentThread() too.
>
> Last but not least, is the version of Python embedded in Postgres the same as the one you used to build PyLucene ?
>
> Andi..
>
>>
>> Here's my code:
>>
>> drop function testing();
>> CREATE FUNCTION testing()
>> RETURNS text
>> AS $$
>>
>> import os
>> import ctypes
>> ctypes.windll.LoadLibrary("jvm")
>> plpy.info(os.environ['Path'])
>>
>> try:
>> import lucene
>> except Exception, e:
>> import traceback
>> plpy.error(traceback.format_exc())
>> else:
>> return ""
>>
>> $$ LANGUAGE plpythonu;
>
Re: ImportError: DLL load failed: The specified module could not be found.
Posted by Andi Vajda <va...@apache.org>.
On Nov 7, 2011, at 22:28, Jiang Fung Wong <ji...@jamiq.com> wrote:
> Dear All,
>
> I got this error when trying to import pylucene inside Postgres PL/Python.
>
> ERROR: ('Traceback (most recent call last):
> File "<string>", line 17, in __plpython_procedure_testing_1517611
> File "d:\\ve\\Lib\\site-packages\\lucene-3.4.0-py2.6-win32.egg\\lucene\\__init__.py",
> line 5, in <module>
> import jcc, _lucene
> File "d:\\ve\\Lib\\site-packages\\jcc-2.11-py2.6-win32.egg\\jcc\\__init__.py",
> line 34, in <module>
> from _jcc import initVM
> ImportError: DLL load failed: The specified module could not be found.
> ',)
>
> I have no isue importing jvm.dll using ctypes, ctypes.windll.LoadLibrary("jvm")
> The path to jvm.dll is also listed on the PATH environment variable,
> from the output of the statement plpy.info(os.environ['Path']) below.
> I have no problem importing pylucene on my system's python
> interpretor, outside Postgres.
>
> How to solve this?
You probably need to set some PATH environment variable to contain the directory that contains the _jcc.dll for the process Postgres is running in.
A Postgres windows user mailing list may have more details for you.
Don't forget that you also must run initVM() from the process' main thread and that each thread calling into PyLucene must call attachCurrentThread() too.
Last but not least, is the version of Python embedded in Postgres the same as the one you used to build PyLucene ?
Andi..
>
> Here's my code:
>
> drop function testing();
> CREATE FUNCTION testing()
> RETURNS text
> AS $$
>
> import os
> import ctypes
> ctypes.windll.LoadLibrary("jvm")
> plpy.info(os.environ['Path'])
>
> try:
> import lucene
> except Exception, e:
> import traceback
> plpy.error(traceback.format_exc())
> else:
> return ""
>
> $$ LANGUAGE plpythonu;