Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying apt & python app with PyAudio (portaudio.h problem) #113

Open
LDK opened this issue Mar 6, 2024 · 0 comments
Open

Deploying apt & python app with PyAudio (portaudio.h problem) #113

LDK opened this issue Mar 6, 2024 · 0 comments

Comments

@LDK
Copy link

LDK commented Mar 6, 2024

Hello there. Much like a previous user, who posted this issue: #77, I am trying to build a web app that uses PyAudio (and in fact, largely have built it and would now like to deploy it). I'm using the heroku-buildpack-apt buildpack, and my pipeline is as follows:

https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku-community/apt.tgz
https://github.com/timanovsky/subdir-heroku-buildpack
heroku/python

(subdir because I have a monorepo with all the django/python stuff in a server/ folder)

My Aptfile contains the following:

portaudio19-dev
python-all-dev

The build fails, despite seeming to succeed in installing the .debs for PortAudio:

-----> Building on the Heroku-22 stack
-----> Using buildpacks:
       1. heroku-community/apt
       2. https://github.com/timanovsky/subdir-heroku-buildpack
       3. heroku/python
-----> Apt app detected
-----> Detected Aptfile or Stack changes, flushing cache
-----> Updating apt caches
       Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
       Get:2 http://archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
       Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
       Get:4 http://apt.postgresql.org/pub/repos/apt jammy-pgdg InRelease [123 kB]
       Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1,792 kB]
       Get:6 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
       Get:7 http://archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,533 kB]
       Get:8 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1,076 kB]
       Get:9 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,347 kB]
       Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,812 kB]
       Get:11 http://apt.postgresql.org/pub/repos/apt jammy-pgdg/main amd64 Packages [488 kB]
       Fetched 26.1 MB in 1s (18.4 MB/s)
       Reading package lists...
W: http://apt.postgresql.org/pub/repos/apt/dists/jammy-pgdg/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
-----> Fetching .debs for portaudio19-dev
       Reading package lists...
       Building dependency tree...
       The following additional packages will be installed:
         alsa-topology-conf alsa-ucm-conf libasound2 libasound2-data libasound2-dev
         libjack-dev libjack0 libportaudio2 libportaudiocpp0
       Suggested packages:
         libasound2-plugins alsa-utils libasound2-doc jackd1 portaudio19-doc
       The following NEW packages will be installed:
         alsa-topology-conf alsa-ucm-conf libasound2 libasound2-data libasound2-dev
         libjack-dev libjack0 libportaudio2 libportaudiocpp0 portaudio19-dev
       0 upgraded, 10 newly installed, 0 to remove and 24 not upgraded.
       Need to get 1,064 kB of archives.
       After this operation, 6,789 kB of additional disk space will be used.
       Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 alsa-topology-conf all 1.2.5.1-2 [15.5 kB]
       Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libasound2-data all 1.2.6.1-1ubuntu1 [19.1 kB]
       Get:3 http://archive.ubuntu.com/ubuntu jammy/main amd64 libasound2 amd64 1.2.6.1-1ubuntu1 [390 kB]
       Get:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 alsa-ucm-conf all 1.2.6.3-1ubuntu1.10 [43.4 kB]
       Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 libasound2-dev amd64 1.2.6.1-1ubuntu1 [110 kB]
       Get:6 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libjack0 amd64 1:0.125.0-3build2 [93.3 kB]
       Get:7 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libjack-dev amd64 1:0.125.0-3build2 [206 kB]
       Get:8 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libportaudio2 amd64 19.6.0-1.1 [65.3 kB]
       Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libportaudiocpp0 amd64 19.6.0-1.1 [16.1 kB]
       Get:10 http://archive.ubuntu.com/ubuntu jammy/universe amd64 portaudio19-dev amd64 19.6.0-1.1 [106 kB]
       Fetched 1,064 kB in 0s (7,392 kB/s)
       Download complete and in download only mode
-----> Fetching .debs for python-all-dev
       Reading package lists...
       Building dependency tree...
       The following additional packages will be installed:
         libpython-all-dev libpython2-dev libpython2-stdlib libpython2.7
         libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib python-all python2
         python2-dev python2-minimal python2.7 python2.7-dev python2.7-minimal
       Suggested packages:
         python2-doc python-tk python2.7-doc binfmt-support
       The following NEW packages will be installed:
         libpython-all-dev libpython2-dev libpython2-stdlib libpython2.7
         libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib python-all
         python-all-dev python2 python2-dev python2-minimal python2.7 python2.7-dev
         python2.7-minimal
       0 upgraded, 15 newly installed, 0 to remove and 24 not upgraded.
       Need to get 7,977 kB of archives.
       After this operation, 32.7 MB of additional disk space will be used.
       Get:1 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 libpython2.7-minimal amd64 2.7.18-13ubuntu1.1 [347 kB]
       Get:2 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 python2.7-minimal amd64 2.7.18-13ubuntu1.1 [1,394 kB]
       Get:3 http://archive.ubuntu.com/ubuntu jammy/universe amd64 python2-minimal amd64 2.7.18-3 [20.8 kB]
       Get:4 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 libpython2.7-stdlib amd64 2.7.18-13ubuntu1.1 [1,977 kB]
       Get:5 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 python2.7 amd64 2.7.18-13ubuntu1.1 [250 kB]
       Get:6 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libpython2-stdlib amd64 2.7.18-3 [7,432 B]
       Get:7 http://archive.ubuntu.com/ubuntu jammy/universe amd64 python2 amd64 2.7.18-3 [9,098 B]
       Get:8 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 libpython2.7 amd64 2.7.18-13ubuntu1.1 [1,159 kB]
       Get:9 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 libpython2.7-dev amd64 2.7.18-13ubuntu1.1 [2,515 kB]
       Get:10 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libpython2-dev amd64 2.7.18-3 [7,512 B]
       Get:11 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libpython-all-dev amd64 2.7.18-3 [922 B]
       Get:12 http://archive.ubuntu.com/ubuntu jammy/universe amd64 python-all amd64 2.7.18-3 [902 B]
       Get:13 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 python2.7-dev amd64 2.7.18-13ubuntu1.1 [286 kB]
       Get:14 http://archive.ubuntu.com/ubuntu jammy/universe amd64 python2-dev amd64 2.7.18-3 [1,064 B]
       Get:15 http://archive.ubuntu.com/ubuntu jammy/universe amd64 python-all-dev amd64 2.7.18-3 [922 B]
       Fetched 7,977 kB in 0s (41.3 MB/s)
       Download complete and in download only mode
-----> Installing alsa-topology-conf_1.2.5.1-2_all.deb
-----> Installing alsa-ucm-conf_1.2.6.3-1ubuntu1.10_all.deb
-----> Installing libasound2_1.2.6.1-1ubuntu1_amd64.deb
-----> Installing libasound2-data_1.2.6.1-1ubuntu1_all.deb
-----> Installing libasound2-dev_1.2.6.1-1ubuntu1_amd64.deb
-----> Installing libjack0_1%3a0.125.0-3build2_amd64.deb
-----> Installing libjack-dev_1%3a0.125.0-3build2_amd64.deb
-----> Installing libportaudio2_19.6.0-1.1_amd64.deb
-----> Installing libportaudiocpp0_19.6.0-1.1_amd64.deb
-----> Installing libpython2.7_2.7.18-13ubuntu1.1_amd64.deb
-----> Installing libpython2.7-dev_2.7.18-13ubuntu1.1_amd64.deb
-----> Installing libpython2.7-minimal_2.7.18-13ubuntu1.1_amd64.deb
-----> Installing libpython2.7-stdlib_2.7.18-13ubuntu1.1_amd64.deb
-----> Installing libpython2-dev_2.7.18-3_amd64.deb
-----> Installing libpython2-stdlib_2.7.18-3_amd64.deb
-----> Installing libpython-all-dev_2.7.18-3_amd64.deb
-----> Installing portaudio19-dev_19.6.0-1.1_amd64.deb
-----> Installing python2_2.7.18-3_amd64.deb
-----> Installing python2.7_2.7.18-13ubuntu1.1_amd64.deb
-----> Installing python2.7-dev_2.7.18-13ubuntu1.1_amd64.deb
-----> Installing python2.7-minimal_2.7.18-13ubuntu1.1_amd64.deb
-----> Installing python2-dev_2.7.18-3_amd64.deb
-----> Installing python2-minimal_2.7.18-3_amd64.deb
-----> Installing python-all_2.7.18-3_amd64.deb
-----> Installing python-all-dev_2.7.18-3_amd64.deb
-----> Writing profile script
-----> Rewrite package-config files
-----> Subdir buildpack app detected
-----> Subdir buildpack in /server
       creating cache: /tmp/codon/tmp/cache
       created tmp dir: /tmp/codon/tmp/cache/subdirhFxmH
       moving working dir: /server to /tmp/codon/tmp/cache/subdirhFxmH
       cleaning build dir /tmp/build_c41bde5a
       copying preserved work dir from cache /tmp/codon/tmp/cache/subdirhFxmH to build dir /tmp/build_c41bde5a
       cleaning tmp dir /tmp/codon/tmp/cache/subdirhFxmH
-----> Python app detected
-----> No Python version was specified. Using the buildpack default: python-3.12.2
       To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
-----> Installing python-3.12.2
-----> Installing pip 23.3.2, setuptools 68.2.2 and wheel 0.42.0
-----> Installing SQLite3
-----> Installing requirements with pip
       Collecting asgiref==3.7.2 (from -r requirements.txt (line 1))
         Downloading asgiref-3.7.2-py3-none-any.whl.metadata (9.2 kB)
       Collecting certifi==2023.7.22 (from -r requirements.txt (line 2))
         Downloading certifi-2023.7.22-py3-none-any.whl.metadata (2.2 kB)
       Collecting distlib==0.3.8 (from -r requirements.txt (line 3))
         Downloading distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB)
       Collecting Django==5.0 (from -r requirements.txt (line 4))
         Downloading Django-5.0-py3-none-any.whl.metadata (4.1 kB)
       Collecting django-cors-headers==4.3.1 (from -r requirements.txt (line 5))
         Downloading django_cors_headers-4.3.1-py3-none-any.whl.metadata (16 kB)
       Collecting djangorestframework==3.14.0 (from -r requirements.txt (line 6))
         Downloading djangorestframework-3.14.0-py3-none-any.whl.metadata (10 kB)
       Collecting djangorestframework-simplejwt==5.3.1 (from -r requirements.txt (line 7))
         Downloading djangorestframework_simplejwt-5.3.1-py3-none-any.whl.metadata (4.3 kB)
       Collecting filelock==3.13.1 (from -r requirements.txt (line 8))
         Downloading filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
       Collecting mysqlclient==2.2.1 (from -r requirements.txt (line 9))
         Downloading mysqlclient-2.2.1.tar.gz (89 kB)
         Installing build dependencies: started
         Installing build dependencies: finished with status 'done'
         Getting requirements to build wheel: started
         Getting requirements to build wheel: finished with status 'done'
         Installing backend dependencies: started
         Installing backend dependencies: finished with status 'done'
         Preparing metadata (pyproject.toml): started
         Preparing metadata (pyproject.toml): finished with status 'done'
       Collecting platformdirs==4.1.0 (from -r requirements.txt (line 10))
         Downloading platformdirs-4.1.0-py3-none-any.whl.metadata (11 kB)
       Collecting protobuf==4.24.4 (from -r requirements.txt (line 11))
         Downloading protobuf-4.24.4-cp37-abi3-manylinux2014_x86_64.whl.metadata (540 bytes)
       Collecting PyAudio==0.2.14 (from -r requirements.txt (line 12))
         Downloading PyAudio-0.2.14.tar.gz (47 kB)
         Installing build dependencies: started
         Installing build dependencies: finished with status 'done'
         Getting requirements to build wheel: started
         Getting requirements to build wheel: finished with status 'done'
         Preparing metadata (pyproject.toml): started
         Preparing metadata (pyproject.toml): finished with status 'done'
       Collecting pydub==0.25.1 (from -r requirements.txt (line 13))
         Downloading pydub-0.25.1-py2.py3-none-any.whl.metadata (1.4 kB)
       Collecting PyJWT==2.8.0 (from -r requirements.txt (line 14))
         Downloading PyJWT-2.8.0-py3-none-any.whl.metadata (4.2 kB)
       Collecting python-decouple==3.8 (from -r requirements.txt (line 15))
         Downloading python_decouple-3.8-py3-none-any.whl.metadata (14 kB)
       Collecting pytz==2023.3.post1 (from -r requirements.txt (line 16))
         Downloading pytz-2023.3.post1-py2.py3-none-any.whl.metadata (22 kB)
       Collecting PyYAML==6.0.1 (from -r requirements.txt (line 17))
         Downloading PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
       Collecting rptree==0.1.1 (from -r requirements.txt (line 18))
         Downloading rptree-0.1.1-py3-none-any.whl.metadata (2.0 kB)
       Collecting simplejson==3.19.2 (from -r requirements.txt (line 19))
         Downloading simplejson-3.19.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.1 kB)
       Collecting six==1.16.0 (from -r requirements.txt (line 20))
         Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
       Collecting sqlparse==0.4.4 (from -r requirements.txt (line 21))
         Downloading sqlparse-0.4.4-py3-none-any.whl.metadata (4.0 kB)
       Collecting wheel==0.41.3 (from -r requirements.txt (line 22))
         Downloading wheel-0.41.3-py3-none-any.whl.metadata (2.2 kB)
       Downloading asgiref-3.7.2-py3-none-any.whl (24 kB)
       Downloading certifi-2023.7.22-py3-none-any.whl (158 kB)
       Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
       Downloading Django-5.0-py3-none-any.whl (8.1 MB)
       Downloading django_cors_headers-4.3.1-py3-none-any.whl (12 kB)
       Downloading djangorestframework-3.14.0-py3-none-any.whl (1.1 MB)
       Downloading djangorestframework_simplejwt-5.3.1-py3-none-any.whl (101 kB)
       Downloading filelock-3.13.1-py3-none-any.whl (11 kB)
       Downloading platformdirs-4.1.0-py3-none-any.whl (17 kB)
       Downloading protobuf-4.24.4-cp37-abi3-manylinux2014_x86_64.whl (311 kB)
       Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)
       Downloading PyJWT-2.8.0-py3-none-any.whl (22 kB)
       Downloading python_decouple-3.8-py3-none-any.whl (9.9 kB)
       Downloading pytz-2023.3.post1-py2.py3-none-any.whl (502 kB)
       Downloading PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (724 kB)
       Downloading rptree-0.1.1-py3-none-any.whl (5.0 kB)
       Downloading simplejson-3.19.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (152 kB)
       Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
       Downloading sqlparse-0.4.4-py3-none-any.whl (41 kB)
       Downloading wheel-0.41.3-py3-none-any.whl (65 kB)
       Building wheels for collected packages: mysqlclient, PyAudio
         Building wheel for mysqlclient (pyproject.toml): started
         Building wheel for mysqlclient (pyproject.toml): finished with status 'done'
         Created wheel for mysqlclient: filename=mysqlclient-2.2.1-cp312-cp312-linux_x86_64.whl size=76627 sha256=78e8fa855f7f2a06f61ff2142d93ff8a2cc8e7c24fefd29c5fb9e6c8ba8e18db
         Stored in directory: /tmp/pip-ephem-wheel-cache-yg2paj_j/wheels/aa/99/50/f03fd49e3a91fdf9c28a434e12e463d65c9c2ac3f35a94975d
         Building wheel for PyAudio (pyproject.toml): started
         Building wheel for PyAudio (pyproject.toml): finished with status 'error'
         error: subprocess-exited-with-error
         
         × Building wheel for PyAudio (pyproject.toml) did not run successfully.
         │ exit code: 1
         ╰─> [18 lines of output]
             running bdist_wheel
             running build
             running build_py
             creating build
             creating build/lib.linux-x86_64-cpython-312
             creating build/lib.linux-x86_64-cpython-312/pyaudio
             copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-312/pyaudio
             running build_ext
             building 'pyaudio._portaudio' extension
             creating build/temp.linux-x86_64-cpython-312
             creating build/temp.linux-x86_64-cpython-312/src
             creating build/temp.linux-x86_64-cpython-312/src/pyaudio
             gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include -I/usr/include -I/app/.heroku/python/include/python3.12 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-312/src/pyaudio/device_api.o
             src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
                 9 | #include "portaudio.h"
                   |          ^~~~~~~~~~~~~
             compilation terminated.
             error: command '/usr/bin/gcc' failed with exit code 1
             [end of output]
         
         note: This error originates from a subprocess, and is likely not a problem with pip.
         ERROR: Failed building wheel for PyAudio
       Successfully built mysqlclient
       Failed to build PyAudio
       ERROR: Could not build wheels for PyAudio, which is required to install pyproject.toml-based projects
 !     Push rejected, failed to compile Python app.
 !     Push failed

any ideas?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant