Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java RuntimeError: Unable to load DLL #1

Closed
devxoul opened this issue May 3, 2016 · 2 comments
Closed

Java RuntimeError: Unable to load DLL #1

devxoul opened this issue May 3, 2016 · 2 comments

Comments

@devxoul
Copy link

devxoul commented May 3, 2016

This is my rank.py:

from textrankr import TextRank

text = open('input.txt', 'r').read()
textrank = TextRank(text)
print textrank.reordered[0].text

When I run this, I've got an error:

$ python rank.py
Traceback (most recent call last):
  File "rank.py", line 1, in <module>
    from textrankr import TextRank
  File "/Users/xoul/Desktop/rank/venv/lib/python2.7/site-packages/textrankr/__init__.py", line 13, in <module>
    _kkma = Kkma()
  File "/Users/xoul/Desktop/rank/venv/lib/python2.7/site-packages/konlpy/tag/_kkma.py", line 87, in __init__
    jvm.init_jvm(jvmpath)
  File "/Users/xoul/Desktop/rank/venv/lib/python2.7/site-packages/konlpy/jvm.py", line 51, in init_jvm
    '-ea', '-Xmx768m')
  File "/Users/xoul/Desktop/rank/venv/lib/python2.7/site-packages/jpype/_core.py", line 50, in startJVM
    _jpype.startup(jvm, tuple(args), True)
RuntimeError: Unable to load DLL [/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libjvm.dylib], error = dlopen(/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libjvm.dylib, 9): no suitable image found.  Did find:
    /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libjvm.dylib: mach-o, but wrong architecture at native/common/include/jp_platform_linux.h:45

Is there any prerequisite to run example?

@devxoul
Copy link
Author

devxoul commented May 3, 2016

konlpy/konlpy#76 (comment) could solve the problem.

@devxoul devxoul closed this as completed May 3, 2016
@tada20001
Copy link

저도 같은 문제가 발생하고 있는데요 ㅠㅠ... 아래에서 jvmpath 코드를 어떻게 수정하면 되나요? 초보자라 자세히 가르쳐 주셨으면 합니다...

def init_jvm(jvmpath=None):

if jpype.isJVMStarted():
    logging.warning('JVM is already running. Do not init twice!')
    return

folder_suffix = [
    '{0}', '{0}{1}bin',
    '{0}{1}jhannanum-0.8.4.jar',
    '{0}{1}kkma-2.0.jar',
    '{0}{1}komoran-2.4-e.jar',
    '{0}{1}shineware-common-2.0.jar', '{0}{1}shineware-ds-1.0.jar',
    '{0}{1}snakeyaml-1.12.jar', '{0}{1}scala-library-2.11.4.jar', '{0}{1}twitter-korean-text-2.4.3.jar', '{0}{1}twitter-text-1.10.1.jar',
    '{0}{1}*']

javadir = '%s%sjava' % (utils.installpath, os.sep)

args = [javadir, os.sep]
classpath = os.pathsep.join(f.format(*args) for f in folder_suffix)

jvmpath = jvmpath or jpype.getDefaultJVMPath()

# NOTE: Temporary patch for Issue #76. Erase when possible.
if sys.platform=='darwin'\
        and jvmpath.find('1.8.0') > 0\
        and jvmpath.endswith('libjvm.dylib'):
            jvmpath = '%s/lib/jli/libjli.dylib' % jvmpath.split('/lib/')[0]

if jvmpath:
    jpype.startJVM(jvmpath, '-Djava.class.path=%s' % classpath,
                            '-Dfile.encoding=UTF8',
                            '-ea', '-Xmx768m')
else:
    raise ValueError("Please specify the JVM path.")

theeluwin pushed a commit that referenced this issue Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants