k2-fsa / fast_rnnt

A torch implementation of a recursion which turns out to be useful for RNN-T.
Other
139 stars 22 forks source link

Issue in installation #18

Closed jrplatin closed 1 year ago

jrplatin commented 1 year ago

Hi,

I am trying to install this package, but I run into the following error after cloning and running setup.py

[ 20%] Linking CXX shared library ../../lib/libmutual_information_core.so /usr/bin/ld: cannot find -lmkl_intel_ilp64 /usr/bin/ld: cannot find -lmkl_core /usr/bin/ld: cannot find -lmkl_intel_thread collect2: error: ld returned 1 exit status make[3]: [fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/build.make:99: lib/libmutual_information_core.so] Error 1 make[2]: [CMakeFiles/Makefile2:191: fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/all] Error 2 make[1]: [CMakeFiles/Makefile2:225: fast_rnnt/python/csrc/CMakeFiles/_fast_rnnt.dir/rule] Error 2 make: [Makefile:131: _fast_rnnt] Error 2 Traceback (most recent call last): File "setup.py", line 105, in setuptools.setup( File "/opt/conda/envs/ptca/lib/python3.8/site-packages/setuptools/init.py", line 153, in setup return distutils.core.setup(**attrs) File "/opt/conda/envs/ptca/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/opt/conda/envs/ptca/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/opt/conda/envs/ptca/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/opt/conda/envs/ptca/lib/python3.8/site-packages/setuptools/command/install.py", line 74, in run self.do_egg_install() File "/opt/conda/envs/ptca/lib/python3.8/site-packages/setuptools/command/install.py", line 116, in do_egg_install self.run_command('bdist_egg') File "/opt/conda/envs/ptca/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/opt/conda/envs/ptca/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/opt/conda/envs/ptca/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 164, in run cmd = self.call_command('install_lib', warn_dir=0) File "/opt/conda/envs/ptca/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 150, in call_command self.run_command(cmdname) File "/opt/conda/envs/ptca/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/opt/conda/envs/ptca/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/opt/conda/envs/ptca/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/opt/conda/envs/ptca/lib/python3.8/distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/opt/conda/envs/ptca/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/opt/conda/envs/ptca/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/opt/conda/envs/ptca/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run _build_ext.run(self) File "/opt/conda/envs/ptca/lib/python3.8/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/opt/conda/envs/ptca/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "/opt/conda/envs/ptca/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "setup.py", line 59, in build_extension raise Exception( Exception: Build fast_rnnt failed. Please check the error message. You can ask for help by creating an issue on GitHub.

Click: https://github.com/danpovey/fast_rnnt/issues/new

csukuangfj commented 1 year ago

How did you install PyTorch?

And what is the output of

conda list
python3 -m torch.utils.collect_env
jrplatin commented 1 year ago

I am using a Docker image, but I'm using PyTorch 1.12 for CUDA 11.3 (same version as my install).

I listed the results of the two calls here:

res.txt

csukuangfj commented 1 year ago

What is the output of


find $CONDA_PREFIX -name "libmkl*"
find $CONDA_PREFIX -name "libmkl_core*"
jrplatin commented 1 year ago

I got this:

Thanks for your help so far! output.txt

csukuangfj commented 1 year ago

Well, you only have

/opt/conda/envs/ptca/lib/libmkl_core.so.2

but it is looking for /usr/bin/ld: cannot find -lmkl_core, i.e., libmkl_core.so.

Since you are using conda, I suggest that you use conda install to install PyTorch, which will also install mkl for you.

jrplatin commented 1 year ago

Got it thanks!

jrplatin commented 1 year ago

Quick update: I just had to run sudo apt-get install intel-mkl and it worked!