I am trying to install pyaudio to my docker container and I was wondering if anyone had any solution for Windows.
I have tried two methods:
Method 1:
Using pipwin - Error Code:
=> [3/7] RUN pip install pipwin 18.9s=> [4/7] RUN pip install wave 7.6s=> [5/7] RUN pip install argparse 5.1s=> [6/7] RUN pip install boto3 12.2s=> ERROR [7/7] RUN pipwin install pyaudio 74.3s
------> [7/7] RUN pipwin install pyaudio:
#11 1.941 /usr/local/lib/python3.9/site-packages/pipwin/command.py:66: UserWarning: Found a non Windows system. Package installation might not work.
#11 1.941 warn("Found a non Windows system. Package installation might not work.")
#11 72.49 Building cache. Hang on . . .
#11 72.49 Done
#11 72.49 Package `pyaudio` found in cache
#11 72.49 Downloading package . . .
#11 72.49 https://download.lfd.uci.edu/pythonlibs/q4trcu4l/PyAudio-0.2.11-cp39-cp39-win_amd64.whl
#11 72.49 PyAudio-0.2.11-cp39-cp39-win_amd64.whl
#11 72.49 ERROR: PyAudio-0.2.11-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.
#11 73.61 [*] 108 kB / 108 kB @ 67 kB/s [##################] [100%, 0s left]
#11 73.61 Traceback (most recent call last):
#11 73.61 File "/usr/local/bin/pipwin", line 8, in <module>
#11 73.61 sys.exit(main())
#11 73.61 File "/usr/local/lib/python3.9/site-packages/pipwin/command.py", line 103, in main
#11 73.62 cache.install(package)
#11 73.62 File "/usr/local/lib/python3.9/site-packages/pipwin/pipwin.py", line 301, in install
#11 73.62 subprocess.check_call([executable, "-m", "pip", "install", wheel_file])
#11 73.62 File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
#11 73.62 raise CalledProcessError(retcode, cmd)
#11 73.62 subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', 'install', '/root/pipwin/PyAudio-0.2.11-cp39-cp39-win_amd64.whl']' returned non-zero exit status 1.
------
executor failed running [/bin/sh -c pipwin install pyaudio]: exit code: 1
Just using pip:
=> ERROR [7/7] RUN pip install pyaudio 8.5s
------> [7/7] RUN pip install pyaudio:
#11 4.105 Collecting pyaudio
#11 4.203 Downloading PyAudio-0.2.11.tar.gz (37 kB)
#11 5.041 Building wheels for collected packages: pyaudio
#11 5.043 Building wheel for pyaudio (setup.py): started
#11 5.991 Building wheel for pyaudio (setup.py): finished with status 'error'
#11 5.991 ERROR: Command errored out with exit status 1:
#11 5.991 command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-c7pjw1yf/pyaudio_d99f4560914e4594a2e9c0b15048a349/setup.py'"'"'; __file__='"'"'/tmp/pip-install-c7pjw1yf/pyaudio_d99f4560914e4594a2e9c0b15048a349/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-oxbow8yl
#11 5.991 cwd: /tmp/pip-install-c7pjw1yf/pyaudio_d99f4560914e4594a2e9c0b15048a349/
#11 5.991 Complete output (16 lines):
#11 5.991 running bdist_wheel
#11 5.991 running build
#11 5.991 running build_py
#11 5.991 creating build
#11 5.991 creating build/lib.linux-x86_64-3.9
#11 5.991 copying src/pyaudio.py -> build/lib.linux-x86_64-3.9
#11 5.991 running build_ext
#11 5.991 building '_portaudio' extension
#11 5.991 creating build/temp.linux-x86_64-3.9
#11 5.991 creating build/temp.linux-x86_64-3.9/src
#11 5.991 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.9/src/_portaudiomodule.o
#11 5.991 src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
#11 5.991 #include "portaudio.h"
#11 5.991 ^~~~~~~~~~~~~
#11 5.991 compilation terminated.
#11 5.991 error: command '/usr/bin/gcc' failed with exit code 1
#11 5.991 ----------------------------------------
#11 5.992 ERROR: Failed building wheel for pyaudio
#11 5.993 Running setup.py clean for pyaudio
#11 6.693 Failed to build pyaudio
#11 7.003 Installing collected packages: pyaudio
#11 7.012 Running setup.py install for pyaudio: started
#11 7.897 Running setup.py install for pyaudio: finished with status 'error'
#11 7.897 ERROR: Command errored out with exit status 1:
#11 7.897 command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-c7pjw1yf/pyaudio_d99f4560914e4594a2e9c0b15048a349/setup.py'"'"'; __file__='"'"'/tmp/pip-install-c7pjw1yf/pyaudio_d99f4560914e4594a2e9c0b15048a349/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lxhr8cmy/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/pyaudio
#11 7.897 cwd: /tmp/pip-install-c7pjw1yf/pyaudio_d99f4560914e4594a2e9c0b15048a349/
#11 7.897 Complete output (16 lines):
#11 7.897 running install
#11 7.897 running build
#11 7.897 running build_py
#11 7.897 creating build
#11 7.897 creating build/lib.linux-x86_64-3.9
#11 7.897 copying src/pyaudio.py -> build/lib.linux-x86_64-3.9
#11 7.897 running build_ext
#11 7.897 building '_portaudio' extension
#11 7.897 creating build/temp.linux-x86_64-3.9
#11 7.897 creating build/temp.linux-x86_64-3.9/src
#11 7.897 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.9/src/_portaudiomodule.o
#11 7.897 src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
#11 7.897 #include "portaudio.h"
#11 7.897 ^~~~~~~~~~~~~
#11 7.897 compilation terminated.
#11 7.897 error: command '/usr/bin/gcc' failed with exit code 1
#11 7.897 ----------------------------------------
#11 7.899 ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-c7pjw1yf/pyaudio_d99f4560914e4594a2e9c0b15048a349/setup.py'"'"'; __file__='"'"'/tmp/pip-install-c7pjw1yf/pyaudio_d99f4560914e4594a2e9c0b15048a349/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lxhr8cmy/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/pyaudio Check the logs for full command output.
------
executor failed running [/bin/sh -c pip install pyaudio]: exit code: 1
Can anyone help?