k2
1.24.3

Contents:

  • Installation
    • From pre-compiled wheels (recommended)
      • Pre-compiled CPU wheels (Linux)
      • Pre-compiled CUDA wheels (Linux)
      • Pre-compiled CPU wheels (macOS)
      • Pre-compiled CPU wheels (Windows)
      • Installation examples
        • Linux (CPU) example
        • macOS (CPU) example
        • Windows (CPU) example
        • Linux (CUDA) example
    • Install from source
    • For developers
    • CUDA and cuDNN
    • FAQs
    • Reporting issues
  • Core concepts in k2
  • Python tutorials
  • Python API reference
k2
  • »
  • Installation »
  • From pre-compiled wheels (recommended)
  • Edit on GitHub

From pre-compiled wheels (recommended)

We provide pre-compiled wheels for the following platforms:

  • Pre-compiled CPU wheels (Linux)
  • Pre-compiled CUDA wheels (Linux)
  • Pre-compiled CPU wheels (macOS)
  • Pre-compiled CPU wheels (Windows)

We recommend that you use this approach to install k2.

Hint

Please always install the latest version of k2.

Installation examples

We provide several examples below to show you how to install k2

Linux (CPU) example

Suppose that we want to install the following wheel

https://huggingface.co/csukuangfj/k2/resolve/main/cpu/k2-1.24.3.dev20230719+cpu.torch2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

we can use one of the following methods:

# method 1
pip install torch==2.0.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install k2==1.24.3.dev20230719+cpu.torch2.0.1 -f https://k2-fsa.github.io/k2/cpu.html

# method 2
pip install torch==2.0.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
wget https://huggingface.co/csukuangfj/k2/resolve/main/cpu/k2-1.24.3.dev20230719+cpu.torch2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pip install ./k2-1.24.3.dev20230719+cpu.torch2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Hint

You can visit https://k2-fsa.github.io/k2/cpu.html to see avaiable versions of k2.

macOS (CPU) example

Suppose we want to use the following wheel:

https://huggingface.co/csukuangfj/k2/resolve/main/macos/k2-1.24.3.dev20230720+cpu.torch2.0.1-cp38-cp38-macosx_10_9_x86_64.whl

we can use the following methods:

# method 1
pip install torch==2.0.1
pip install k2==1.24.3.dev20230720+cpu.torch2.0.1 -f https://k2-fsa.github.io/k2/cpu.html

# method 2
pip install torch==2.0.1
wget https://huggingface.co/csukuangfj/k2/resolve/main/macos/k2-1.24.3.dev20230720+cpu.torch2.0.1-cp38-cp38-macosx_10_9_x86_64.whl
pip install ./k2-1.24.3.dev20230720+cpu.torch2.0.1-cp38-cp38-macosx_10_9_x86_64.whl

Hint

You can visit https://k2-fsa.github.io/k2/cpu.html to see avaiable versions of k2.

Windows (CPU) example

Suppose we want to install the following wheel

https://huggingface.co/csukuangfj/k2/resolve/main/windows-cpu/k2-1.24.3.dev20230726+cpu.torch2.0.1-cp38-cp38-win_amd64.whl

we can use the one of the following methods:

# method 1
pip install torch==2.0.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install k2==1.24.3.dev20230726+cpu.torch2.0.1 -f https://k2-fsa.github.io/k2/cpu.html

# method 2
pip install torch==2.0.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
wget https://huggingface.co/csukuangfj/k2/resolve/main/windows-cpu/k2-1.24.3.dev20230726+cpu.torch2.0.1-cp38-cp38-win_amd64.whl
pip install k2-1.24.3.dev20230726+cpu.torch2.0.1-cp38-cp38-win_amd64.whl

Hint

If you want to build k2 with CUDA support on Windows, please consider compiling k2 from source.

Hint

You can visit https://k2-fsa.github.io/k2/cpu.html to see avaiable versions of k2.

Linux (CUDA) example

Suppose we want to install

https://huggingface.co/csukuangfj/k2/resolve/main/cuda/k2-1.24.3.dev20230718+cuda11.7.torch2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

we can use the following methods:

# method 1
pip install torch==2.0.1+cu117 -f https://download.pytorch.org/whl/torch_stable.html
pip install k2==1.24.3.dev20230718+cuda11.7.torch2.0.1 -f https://k2-fsa.github.io/k2/cuda.html

# method 2
pip install torch==2.0.1+cu117 -f https://download.pytorch.org/whl/torch_stable.html
wget https://huggingface.co/csukuangfj/k2/resolve/main/cuda/k2-1.24.3.dev20230718+cuda11.7.torch2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pip install ./k2-1.24.3.dev20230718+cuda11.7.torch2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Hint

You can visit https://k2-fsa.github.io/k2/cuda.html to see avaiable versions of k2.

Previous Next

© Copyright 2020-2022, k2 development team.

Built with Sphinx using a theme provided by Read the Docs.