Install the Python Package

You can select one of the following methods to install the Python package.

Method 1 (From pre-compiled wheels)

Hint

This method supports x86_64, arm64 (e.g., Mac M1, 64-bit Raspberry Pi), and arm32 (e.g., 32-bit Raspberry Pi).

pip install sherpa-onnx

To check you have installed sherpa-onnx successfully, please run

python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"

which sherpa-onnx
sherpa-onnx --help

ls -lh $(dirname $(which sherpa-onnx))/sherpa-onnx*

Method 2 (From source)

git clone https://github.com/k2-fsa/sherpa-onnx
cd sherpa-onnx
python3 setup.py install

Method 3 (For developers)

git clone https://github.com/k2-fsa/sherpa-onnx
cd sherpa-onnx
mkdir build
cd build

cmake \
  -DSHERPA_ONNX_ENABLE_PYTHON=ON \
  -DBUILD_SHARED_LIBS=ON \
  -DSHERPA_ONNX_ENABLE_CHECK=OFF \
  -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
  -DSHERPA_ONNX_ENABLE_C_API=OFF \
  -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
  ..

make -j
export PYTHONPATH=$PWD/../sherpa-onnx/python/:$PWD/lib:$PYTHONPATH

Check your installation

To check that sherpa-onnx has been successfully installed, please use:

python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"

It should print some output like below:

/Users/fangjun/py38/lib/python3.8/site-packages/sherpa_onnx/__init__.py

Please refer to:

for usages.

Please refer to Pre-trained models for a list of pre-trained models.