k2-fsa / k2

FSA/FST algorithms, differentiable, with PyTorch compatibility.
https://k2-fsa.github.io/k2
Apache License 2.0
1.1k stars 214 forks source link

Provide a script to install k2 automatically #1223

Open csukuangfj opened 1 year ago

csukuangfj commented 1 year ago

Many users have some issues when they come to install k2 and they find that it is quite difficult to install it.

I suggest that we provide a single script ./install-k2.sh to install k2 automatically.

The script should ask the following questions:

The script should NOT ask for sudo permission.

Also, we should setup GitHub actions to test the script.

Help from the community is appreciated.

danpovey commented 1 year ago

In my opinion much of the benefit of this would come from the ability to customize to a specific situation, and to offer advice. E.g. what is the base version of python (and is it part of a conda install); and do we have any limitations on the torch version, e.g. torch == something, torch >= something; do we have limitations on the cuda driver e.g. driver <= something, because we dont have root?

csukuangfj commented 1 year ago

In my opinion much of the benefit of this would come from the ability to customize to a specific situation, and to offer advice

Yes, I agree. For instance, the script should first query the CUDA driver API version displayed by nvidia-smi and then display a list of available CUDA runtime API versions for users to choose. After selecting the CUDA runtime API version, we then display a list of PyTorch versions.


Note: Use

nvidia-smi | grep "CUDA Version:" | tr -s " " " " |  rev  | cut -d " " -f 2 | rev

to get the driver CUDA API version

desh2608 commented 1 year ago

I have installed k2 on several clusters at this point, and the method that always works for me is to build from source with explicit path to the CUDNN library in the cmake argument, otherwise there is the libcudnn.so error at import time. Of course, this requires later adding the build directory to the PYTHONPATH. So far, I have not been able to use the pip wheel based install successfully.

csukuangfj commented 1 year ago

So far, I have not been able to use the pip wheel based install successfully.

The reason is that all the pre-compiled wheels are built using GitHub actions, which runs on Ubuntu 20.04 or Ubuntu 22.04. The pre-compiled wheels are thus linked with a high version of libstdc++ and libc, which cause errors if your system libc or libstdc++ is too old. (Note: It is not possible to use Ubuntu <= 18.04 in GitHub actions any longer).

I am trying to fix this issue so that you can use pip install even if your system libc is not updated.