Skip to content

Adapt pydub to Python 3.13 (audioop removed) #867

@netanelcyber

Description

@netanelcyber

Description:
Python 3.13 has removed the built-in audioop module, which pydub currently depends on in pydub/utils.py. As a result, import audioop fails on Python 3.13.

Proposed solution:

  • Wrap the import in a try-except block:
try:
    import audioop
except ImportError:
    import pyaudioop as audioop  # fallback for Python 3.13+
  • Add pyaudioop as an optional dependency in setup.py or pyproject.toml.
  • Optionally, include a clear error message if neither audioop nor pyaudioop is available.

Impact:
This change ensures pydub remains compatible with Python 3.13 and higher, while maintaining backward compatibility with older Python versions.

Reference:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions