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

simpleaudio dependency breaks build with docker #2

Open
viac92 opened this issue Sep 12, 2024 · 3 comments
Open

simpleaudio dependency breaks build with docker #2

viac92 opened this issue Sep 12, 2024 · 3 comments

Comments

@viac92
Copy link

viac92 commented Sep 12, 2024

Hi!

I'm trying to run a container with the SDK installed on but every time I tried to achieve this I get this error:

Running setup.py install for simpleaudio: finished with status 'error'
error: subprocess-exited-with-error

× Running setup.py install for simpleaudio did not run successfully.
│ exit code: 1
   ╰─> [21 lines of output]
       running install
       running build
       running build_py
       creating build
       creating build/lib.linux-x86_64-3.9
       creating build/lib.linux-x86_64-3.9/simpleaudio
       copying simpleaudio/__init__.py -> build/lib.linux-x86_64-3.9/simpleaudio
       copying simpleaudio/shiny.py -> build/lib.linux-x86_64-3.9/simpleaudio
       copying simpleaudio/functionchecks.py -> build/lib.linux-x86_64-3.9/simpleaudio
       creating build/lib.linux-x86_64-3.9/simpleaudio/test_audio
       copying simpleaudio/test_audio/c.wav -> build/lib.linux-x86_64-3.9/simpleaudio/test_audio
       copying simpleaudio/test_audio/e.wav -> build/lib.linux-x86_64-3.9/simpleaudio/test_audio
       copying simpleaudio/test_audio/g.wav -> build/lib.linux-x86_64-3.9/simpleaudio/test_audio
       copying simpleaudio/test_audio/left_right.wav -> build/lib.linux-x86_64-3.9/simpleaudio/test_audio
       copying simpleaudio/test_audio/notes_2_16_44.wav -> build/lib.linux-x86_64-3.9/simpleaudio/test_audio
       running build_ext
       building 'simpleaudio._simpleaudio' extension
       creating build/temp.linux-x86_64-3.9
       creating build/temp.linux-x86_64-3.9/c_src
       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DDEBUG=0 -I/usr/local/include/python3.9 -c c_src/posix_mutex.c -o build/temp.linux-x86_64-3.9/c_src/posix_mutex.o
       error: command 'gcc' failed: No such file or directory
       [end of output]
   
 note: This error originates from a subprocess, and is likely not a problem with pip.
 error: legacy-install-failure
 
 × Encountered error while trying to install package.
 ╰─> simpleaudio

This is my Dockerfile:

FROM python:3.9-slim

WORKDIR /app

# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8765

CMD ["python", "server-script.py"]

I also see that is a common issue for this package:
hamiltron/py-simple-audio#75
hamiltron/py-simple-audio#70
hamiltron/py-simple-audio#62

maybe we should use a more stable and supported package for audio.

In the mean time any suggestions about this error?

Thank you!

@viac92
Copy link
Author

viac92 commented Sep 17, 2024

I managed to compile the docker image adding gcc and portaudio for compatibility with simpleaudio.

So my Dockerfile is:

FROM python:3.9-slim

# Installa le dipendenze necessarie
RUN apt-get update && apt-get install -y \
    gcc \
    portaudio19-dev

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["python", "server-script.py"]

@OkGoDoIt
Copy link
Owner

I used simpleaudio because I thought it would be a simple, low dependency, low hassle solution. Looks like I was wrong. Technically you don’t need simpleaudio unless you’re going to be playing back the audio received from the Frame. It’s only used by the helper function that plays audio.

Does anyone with more Python audio experience have a recommendation for a different package?

@userElaina
Copy link

Does anyone with more Python audio experience have a recommendation for a different package?

hi, how about playsound and pyaudio?

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

3 participants