I was having trouble locating the portaudio library inside an alpine docker container. It appears that this is because ctypes.util.find_library has trouble finding libraries in some cases. The workaround is to make a symlink to the library without the digit:
apk add portaudiocd /usr/lib && ln -s [library.name.[0-9]] [library.name]
I found this solution here: https://bugs.python.org/issue43642
Leaving this issue here for anyone else who is looking for a workaround.
example error text (for searches)
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/local/lib/python3.11/site-packages/sounddevice.py", line 71, in <module>
raise OSError('PortAudio library not found')
OSError: PortAudio library not found
I was having trouble locating the portaudio library inside an alpine docker container. It appears that this is because
ctypes.util.find_library
has trouble finding libraries in some cases. The workaround is to make a symlink to the library without the digit:apk add portaudio
cd /usr/lib && ln -s [library.name.[0-9]] [library.name]
I found this solution here: https://bugs.python.org/issue43642It looks like maybe this issue on the cpython repo has some further discussion: from: https://github.com/python/cpython/pull/18380
Leaving this issue here for anyone else who is looking for a workaround.
example error text (for searches)
libportaudio alpine docker python portaudio