Not able to run the example on Ubuntu 16.04
ImportError: libkaldi-decoder.so: cannot open shared object file: No such file or directory.
Can you share simple steps to do on ubuntu 16.04 && g++ 5.4.0 to run the basic demo?
Just add LD_LIBRARY_PATH environment containing the path where this shared-object of kaldi installation is. For some reason, all the mechanisms of installation are really working badly, and no one is checking them. After that you'll probably have to add also the fst path which was changes to fst-1.6.7 And then maybe use LD_PRELOAD for the mkl libs of intel, which are another issue. Unfortunately nobody checks those installations.
Same here on Ubuntu 18.04 .
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/kaldi/src/lib:/opt/kaldi/tools/openfst/lib did the trick.
Now the python imports of KaldiNNet3OnlineModel and KaldiNNet3OnlineDecoder are running without errors.
Next problem: mkl libs.
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from kaldiasr.nnet3 import KaldiNNet3OnlineModel
>>> kaldi_model = KaldiNNet3OnlineModel('path/to/model_dir')
Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.
As @RaniRaven writes:
And then maybe use LD_PRELOAD for the mkl libs of intel, which are another issue.
Finding and adding libmkl_avx2.so results in:
$ export LD_PRELOAD=/opt/intel/mkl/lib/intel64/libmkl_avx2.so
$ python3
python3: symbol lookup error: /opt/intel/mkl/lib/intel64/libmkl_avx2.so: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8
Ok, something is missing here. Let's add all mkl libs in that directory:
$ export LD_PRELOAD=$(ls /opt/intel/mkl/lib/intel64/*.so | tr '\n' ':')
$ python3
python3: symbol lookup error: /opt/intel/mkl/lib/intel64/libmkl_tbb_thread.so: undefined symbol: _ZN3tbb4task13note_affinityEt
What exactly should LD_PRELOAD look like?
I had exactly the same problem. This worked for me:
$ export LD_PRELOAD=/opt/intel/mkl/lib/intel64/libmkl_core.so:/opt/intel/mkl/lib/intel64/libmkl_sequential.so
Source: https://www.bountysource.com/issues/81528572-intel-mkl-fatal-error-cannot-load-libmkl_def-so
Thanks @hjpulakka. This is working on my system now.
That LD_PRELOAD location didn't work for me. this did:
export LD_PRELOAD=/opt/intel/mkl/lib/intel64/libmkl_def.so:/opt/intel/mkl/lib/intel64/libmkl_avx2.so:/opt/intel/mkl/lib/intel64/libmkl_core.so:/opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so:/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so:/opt/intel/lib/intel64_lin/libiomp5.so
@sravani40 This depends on how you launch your python program. If you using the terminal (with bash) you can simply add these lines to your ~/.bashrc. Here you can read about other methods for persisting environment variables.