Downgrading Python does not work
## Description
Running Pydub on Python 3.13 fails at import time due to missing `audioop` / `pyaudioop`.
Error:
ModuleNotFoundError: No module named 'pyaudioop'
File "pydub/utils.py", line 16, in
import pyaudioop as audioop
## Environment
- Python version: 3.13.0
- OS: Windows 10
- Pydub version: 0.25.1 (latest from PyPI)
## Steps to Reproduce
1. Install Python 3.13
2. `pip install pydub`
3. Run:
```python
from pydub import AudioSegment
Expected Behavior
Pydub should import successfully without requiring unavailable modules.
Actual Behavior
Fails with:
ModuleNotFoundError: No module named 'pyaudioop'
Notes
-
Python 3.13 removed the stdlib audioop module (PEP 594).
-
Pydub currently tries to import pyaudioop, but:
audioop is gone from stdlib
pyaudioop is not installable via pip on Python 3.13 (no wheels, build fails).
-
This leaves Pydub completely broken on Python 3.13 with no pip-installable fix.
Possible Fixes
- Vendor or bundle the
audioop functionality Pydub depends on
- Or mark
pyaudioop as a required dependency and ensure wheels are published for Python 3.13
- Or add a graceful fallback so Pydub works without
audioop features
POSSIBLE PR
OLD
#import pyaudioop as audioop
NEW
try:
import audioop
except ImportError:
try:
import pyaudioop as audioop
except ImportError:
audioop = None # Gracefully disable audioop-dependent features
Add pyaudioop as an optional dependency (so builds don’t break when no wheel is available):
[project.optional-dependencies]
audio = ["pyaudioop>=0.1.0"]
Workarounds
- Downgrading to Python 3.12 resolves the issue
- There is currently no pip-installable way to get
audioop/pyaudioop on Python 3.13
Downgrading Python does not work
ModuleNotFoundError: No module named 'pyaudioop'
File "pydub/utils.py", line 16, in
import pyaudioop as audioop
Expected Behavior
Pydub should import successfully without requiring unavailable modules.
Actual Behavior
Fails with:
Notes
Python 3.13 removed the stdlib
audioopmodule (PEP 594).Pydub currently tries to import
pyaudioop, but:audioopis gone from stdlibpyaudioopis not installable via pip on Python 3.13 (no wheels, build fails).This leaves Pydub completely broken on Python 3.13 with no pip-installable fix.
Possible Fixes
audioopfunctionality Pydub depends onpyaudioopas a required dependency and ensure wheels are published for Python 3.13audioopfeaturesPOSSIBLE PR
OLD
#import pyaudioop as audioop
NEW
try:
import audioop
except ImportError:
try:
import pyaudioop as audioop
except ImportError:
audioop = None # Gracefully disable audioop-dependent features
Add pyaudioop as an optional dependency (so builds don’t break when no wheel is available):
[project.optional-dependencies]
audio = ["pyaudioop>=0.1.0"]
Workarounds
audioop/pyaudioopon Python 3.13