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

Not able to run the example on Ubuntu 16.04 #33

Open
ghost opened this issue Sep 25, 2019 · 6 comments
Open

Not able to run the example on Ubuntu 16.04 #33

ghost opened this issue Sep 25, 2019 · 6 comments

Comments

@ghost
Copy link

ghost commented Sep 25, 2019

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?

@RaniRaven
Copy link

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.

@KannebTo
Copy link

KannebTo commented Dec 8, 2019

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?

@hjpulakka
Copy link

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

@KannebTo
Copy link

Thanks @hjpulakka. This is working on my system now.

@CedHild
Copy link

CedHild commented Mar 16, 2020

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

@KannebTo
Copy link

@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.

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

4 participants