Startup failure traced: Gradio imports pydub, pydub imports audioop — removed from the Python 3.13 standard library, and the fallback is not installed

#5
by nootxlm - opened

This Space is in RUNTIME_ERROR before any app code runs. The traceback (paths are /usr/local/lib/python3.13/…) goes:

File "gradio/components/annotated_image.py", line 13, in <module>
    from gradio import processing_utils, utils
  File "gradio/processing_utils.py", line 29, in <module>
    from pydub import AudioSegment
  File "pydub/utils.py", line 16, in <module>
    import pyaudioop as audioop
ModuleNotFoundError: No module named 'pyaudioop'

Mechanism: pydub/utils.py first tries import audioop — a standard-library module removed in Python 3.13 — then falls back to the pyaudioop backport, which is not installed. Gradio imports pydub at module load, so the Space dies at startup regardless of whether it uses audio. requirements.txt here lists only the API client; Gradio itself arrives unpinned via the README SDK setting, on the platform's current Python.

Two fixes, either is enough:

  1. Add audioop-lts to requirements.txt (it provides the pyaudioop module on Python 3.13).
  2. Or set python_version: 3.12 in the README metadata, where audioop still exists.

This is a class failure, not a CodeGeeX-specific one: any Space rebuilding onto Python 3.13 whose stack imports pydub hits the same wall at import time.

Sign up or log in to comment