PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.37k stars 286 forks source link

ImportError: libportaudio.so.2: cannot open shared object file: No such file or directory #913

Open ruifengma opened 1 month ago

ruifengma commented 1 month ago

(Please use the mailing list for support requests and general discussion. This is only for actual bugs.)

Describe the bug I have installed the portaudio on my centos 7 server with the following steps

wget https://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz
tar -xvf pa_stable_v190700_20210406.tgz
cd portaudio/
./configure
make && make install

and then I install PyAudio with pip install PyAudio then I install whisper-live with pip install whisper-live After that, I deploy the whisper model with python code which is simply

import argparse
from whisper_live.server import TranscriptionServer

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('--port', '-p',
                        type=int,
                        default=9090,
                        help="Websocket port to run the server on.")
    parser.add_argument('--backend', '-b',
                        type=str,
                        default='faster_whisper',
                        help='Backends from ["tensorrt", "faster_whisper"]')
    parser.add_argument('--faster_whisper_custom_model_path', '-fw',
                        type=str, default=None,
                        help="Custom Faster Whisper Model")
    parser.add_argument('--trt_model_path', '-trt',
                        type=str,
                        default=None,
                        help='Whisper TensorRT model path')
    parser.add_argument('--trt_multilingual', '-m',
                        action="store_true",
                        help='Boolean only for TensorRT model. True if multilingual.')
    args = parser.parse_args()

    if args.backend == "tensorrt":
        if args.trt_model_path is None:
            raise ValueError("Please Provide a valid tensorrt model path")

    server = TranscriptionServer()
    server.run(
        "0.0.0.0",
        port=args.port,
        backend=args.backend,
        faster_whisper_custom_model_path=args.faster_whisper_custom_model_path,
        whisper_tensorrt_path=args.trt_model_path,
        trt_multilingual=args.trt_multilingual
    )

python run_server.py --port 8090 --backend faster_whisper -fw "/home/models/faster-whisper-large-v3"

then I use another script to invoke this service with `from whisper_live.client import TranscriptionClient client = TranscriptionClient("localhost", port=8090, lang='en', model='large', use_vad=False)

client('sample.mp3')` and the error came

Could not import the PyAudio C module 'pyaudio._portaudio'.
Traceback (most recent call last):
  File "/data/mrx/whisper_dir/conn_server.py", line 1, in <module>
    from whisper_live.client import TranscriptionClient
  File "/root/miniconda3/envs/whisper/lib/python3.10/site-packages/whisper_live/client.py", line 5, in <module>
    import pyaudio
  File "/root/miniconda3/envs/whisper/lib/python3.10/site-packages/pyaudio/__init__.py", line 111, in <module>
    import pyaudio._portaudio as pa
ImportError: libportaudio.so.2: cannot open shared object file: No such file or directory

To Reproduce Steps to reproduce the behavior. Include code if applicable.

  1. as above

Expected behavior I wish a clear execution

Actual behavior What actually happened. Include a recording if helpful. Error messages or logs longer than a page should be attached as a .txt file.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

Note: PortAudio is a community supported project. If you have a solution, please create a Pull Request for us to consider.