nuance1979 / srilm-python

Python binding for SRI Language Modeling Toolkit implemented in Cython
MIT License
29 stars 7 forks source link

make fails #2

Open lucasrodes opened 8 years ago

lucasrodes commented 8 years ago

Hi, I am using an iMac with El Capitan and the compilation seems to go wrong. I have carefully followed your tutorial. I added the line HAVE_LIBLBFGS=1 in the file $SRILM/common/Makefile.machine.macosx. However it is not working at all. Please let me know if there's anything missing in my description. Thanks in advance.

The log of the error is shown below:

$ make python2.7 -m unittest discover -v tests/ test_discount (unittest.loader.ModuleImportFailure) ... ERROR test_maxent (unittest.loader.ModuleImportFailure) ... ERROR test_ngram (unittest.loader.ModuleImportFailure) ... ERROR test_stats (unittest.loader.ModuleImportFailure) ... ERROR test_vocab (unittest.loader.ModuleImportFailure) ... ERROR

ERROR: test_discount (unittest.loader.ModuleImportFailure)

ImportError: Failed to import test module: test_discount Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests module = self._get_module_from_name(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name import(name) File "/Users/lucasrodes/Documents/Exercise_2/srilm/srilm-python/tests/test_discount.py", line 2, in import srilm.vocab ImportError: dlopen(srilm/vocab.so, 2): Symbol not found: _iconv Referenced from: srilm/vocab.so Expected in: flat namespace in srilm/vocab.so

ERROR: test_maxent (unittest.loader.ModuleImportFailure)

ImportError: Failed to import test module: test_maxent Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests module = self._get_module_from_name(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name import(name) File "/Users/lucasrodes/Documents/Exercise_2/srilm/srilm-python/tests/test_maxent.py", line 2, in import srilm.vocab ImportError: dlopen(srilm/vocab.so, 2): Symbol not found: _iconv Referenced from: srilm/vocab.so Expected in: flat namespace in srilm/vocab.so

ERROR: test_ngram (unittest.loader.ModuleImportFailure)

ImportError: Failed to import test module: test_ngram Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests module = self._get_module_from_name(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name import(name) File "/Users/lucasrodes/Documents/Exercise_2/srilm/srilm-python/tests/test_ngram.py", line 2, in import srilm.vocab ImportError: dlopen(srilm/vocab.so, 2): Symbol not found: _iconv Referenced from: srilm/vocab.so Expected in: flat namespace in srilm/vocab.so

ERROR: test_stats (unittest.loader.ModuleImportFailure)

ImportError: Failed to import test module: test_stats Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests module = self._get_module_from_name(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name import(name) File "/Users/lucasrodes/Documents/Exercise_2/srilm/srilm-python/tests/test_stats.py", line 2, in import srilm.vocab ImportError: dlopen(srilm/vocab.so, 2): Symbol not found: _iconv Referenced from: srilm/vocab.so Expected in: flat namespace in srilm/vocab.so

ERROR: test_vocab (unittest.loader.ModuleImportFailure)

ImportError: Failed to import test module: test_vocab Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests module = self._get_module_from_name(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name import(name) File "/Users/lucasrodes/Documents/Exercise_2/srilm/srilm-python/tests/test_vocab.py", line 2, in import srilm.vocab ImportError: dlopen(srilm/vocab.so, 2): Symbol not found: _iconv Referenced from: srilm/vocab.so Expected in: flat namespace in srilm/vocab.so

Ran 5 tests in 0.012s

FAILED (errors=5) make: *\ [test] Error 1

nuance1979 commented 8 years ago

Can you try rebuild your SRILM with option NO_ICONV=1? For example,

cd srilm
make cleanest
make NO_ICONV=1 World

You could also add NO_ICONV=1 to $SRILM/common/Makefile.machine.macosx as you did with HAVE_LIBLBFGS=1. After that, rebuild srilm-python and see if it works.

kaierlong commented 7 years ago

when I set NO_ICONV=1 and rebuild, I get the same error as above. any help?

nuance1979 commented 7 years ago

@kaierlong after you rebuilt srilm, did you also reinstall srilm-python to pick up the new srilm library?

kaierlong commented 7 years ago

@nuance1979

  1. frist I make cleanest the srilm and make clean the srilm-python
  2. then I add 'NO_ICONV=1' to the file 'common/Makefile.machine.macosx' and rebuild the srilm with make NO_ICONV=1 World
  3. and I rebuild the srilm-python
  4. I try to use the package python3, import srilm, it's all right. but when i import srilm.utils, here goes the error: Traceback (most recent call last): File "/Users/Ziipin/Documents/PyCharm/new/lm/train_lm.py", line 11, in <module> import srilm.utils ImportError: dlopen(/Users/Ziipin/Documents/Kaldi/kaldi-master/tools/srilm/srilm-python/srilm/utils.cpython-36m-darwin.so, 2): Symbol not found: __ZN4File8positionERSo Referenced from: /Users/Ziipin/Documents/Kaldi/kaldi-master/tools/srilm/srilm-python/srilm/utils.cpython-36m-darwin.so Expected in: flat namespace in /Users/Ziipin/Documents/Kaldi/kaldi-master/tools/srilm/srilm-python/srilm/utils.cpython-36m-darwin.so

honestly, there has no errors in my ubuntu-server. I'm unfamiliar with mac. But I think the error not coming from the srilm-python.

cxq92 commented 6 years ago

Hi, it's go to wrong when I try to install srilm -python.Can you help me ? $ patch $SRILM/lm/src/MEModel.cc < srilm/MEModel.cc.patch patch: **** Can't create temporary file /lm/src/MEModel.cc.ojCWGXH : No such file or directory cd $SRILM $ ls bin boot data dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var this is not exist "lm". What can I do?

ashimajain2595 commented 6 years ago

I am facing the same issue as @kaierlong Did anyone find a way to resolve it?

Gayatri012 commented 6 years ago

Hi @nuance1979 I have installed srilm with HAVE_LIBLBFGS = 1 set. I'm using a Cygwin terminal in a Windows system.

When I try to install srilm-python, I get the below error: $ make python3 -m unittest discover -v tests/ test_discount (unittest.loader._FailedTest) ... ERROR test_maxent (unittest.loader._FailedTest) ... ERROR test_ngram (unittest.loader._FailedTest) ... ERROR test_stats (unittest.loader._FailedTest) ... ERROR test_vocab (unittest.loader._FailedTest) ... ERROR

====================================================================== ERROR: test_discount (unittest.loader._FailedTest)

ImportError: Failed to import test module: test_discount Traceback (most recent call last): File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name import(name) File "/cygdrive/c/cygwin64/srilm-1.7.2/srilm-python/tests/test_discount.py", line 2, in import srilm.vocab ModuleNotFoundError: No module named 'srilm.vocab'

====================================================================== ERROR: test_maxent (unittest.loader._FailedTest)

ImportError: Failed to import test module: test_maxent Traceback (most recent call last): File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name import(name) File "/cygdrive/c/cygwin64/srilm-1.7.2/srilm-python/tests/test_maxent.py", line 2, in import srilm.vocab ModuleNotFoundError: No module named 'srilm.vocab'

====================================================================== ERROR: test_ngram (unittest.loader._FailedTest)

ImportError: Failed to import test module: test_ngram Traceback (most recent call last): File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name import(name) File "/cygdrive/c/cygwin64/srilm-1.7.2/srilm-python/tests/test_ngram.py", line 2, in import srilm.vocab ModuleNotFoundError: No module named 'srilm.vocab'

====================================================================== ERROR: test_stats (unittest.loader._FailedTest)

ImportError: Failed to import test module: test_stats Traceback (most recent call last): File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name import(name) File "/cygdrive/c/cygwin64/srilm-1.7.2/srilm-python/tests/test_stats.py", line 2, in import srilm.vocab ModuleNotFoundError: No module named 'srilm.vocab'

====================================================================== ERROR: test_vocab (unittest.loader._FailedTest)

ImportError: Failed to import test module: test_vocab Traceback (most recent call last): File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name import(name) File "/cygdrive/c/cygwin64/srilm-1.7.2/srilm-python/tests/test_vocab.py", line 2, in import srilm.vocab ModuleNotFoundError: No module named 'srilm.vocab'


Ran 5 tests in 0.000s

FAILED (errors=5) make: *** [Makefile:16: test] Error 1

Any help on how to proceed further would be very helpful. @kaierlong how did you resolve your issue? Thanks.