0

I want to install kaldi on the server, when I run the check_dependencies.sh, it tells me that I should install gfortran, but I'm not allowed to use sudo.

I have tried to install gfortran from anaconda, but it only shows that gfortran is not available from current channels, even though I had updated my conda.

Is there any alternative way? thanks!!

iven
  • 1
  • 1
  • Welcome, please take the [tour]. Please show the actual exact error messages. You can compile GCC from source without any admin rights. I did that many times. – Vladimir F Героям слава Jul 28 '21 at 06:17
  • When I run apt install gfortran, it just shows that "Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)." – iven Jul 28 '21 at 07:34
  • As I wrote, compile from source aand install into your home directory. – Vladimir F Героям слава Jul 28 '21 at 07:35
  • This will guide you over the whole process: https://www.owsiak.org/building-opencoarrays-on-macos-everything-from-the-sources-gcc-9-2-0/ - note that I am using macOS, but there is no huge difference here. There are few steps that are macOS specific and you can simply skip them. – Oo.oO Aug 06 '21 at 06:25

2 Answers2

2

You can easily install GCC in your home directory without any root or admin rights.

Just download the source (e.g. a snapshot of your choice), run the provided ./contrib/download_prerequisites and than the holy trio configure --prefix=$HOME --enable-languages=c,c++,fortran, make, make install.

I recommend running these in a different directory. In general, just follow https://gcc.gnu.org/wiki/InstallingGCC A full example of a possible sequence of commands is at the bottom of the page.

1

I typically use the conda-forge::compilers package for my compilation needs. It includes C, C++, and FORTRAN, and abstracts over the platform (i.e., provides equivalent compilers for osx-64, linux-64, etc.).

In this particular case, the following environment appears sufficient to compile Kaldi:

kaldi-compile.yaml

name: kaldi-compile
channels:
  - conda-forge
dependencies:
  - compilers  # this covers C, C++, and FORTRAN
  - make
  - cmake
  - icu
  - openblas   # `mkl` could be used instead

Tested this works in the Mambaforge container:

docker run --rm -it condaforge/mambaforge bash

With:

Docker Session

## create env
mamba create -yn kaldi-compile compilers make cmake icu openblas

## activate env
conda activate kaldi-compile

## basic install instructions
cd /home
git clone https://github.com/kaldi-asr/kaldi.git kaldi --origin upstream
mkdir -p kaldi/build && cd kaldi/build

## configure, build, install
cmake -DCMAKE_INSTALL_PREFIX=../dist .. 
cmake --build . --target install -- -j8
merv
  • 67,214
  • 13
  • 180
  • 245