pydub icon indicating copy to clipboard operation
pydub copied to clipboard

ModuleNotFoundError: No module named 'pyaudioop'

Open ghost opened this issue 1 year ago • 7 comments

Steps to reproduce

Expected behavior

hope worked normally

Actual behavior

Traceback (most recent call last): File "G:\python\Lib\site-packages\pydub\utils.py", line 14, in import audioop ModuleNotFoundError: No module named 'audioop'

Traceback (most recent call last): File "f:\python_play\FuXLogger\processor\processAudio.py", line 1, in from pydub import AudioSegment File "G:\python\Lib\site-packages\pydub_init_.py", line 1, in from .audio_segment import AudioSegment File "G:\python\Lib\site-packages\pydub\audio_segment.py", line 11, in from .utils import mediainfo_json, fsdecode File "G:\python\Lib\site-packages\pydub\utils.py", line 16, in import pyaudioop as audioop ModuleNotFoundError: No module named 'pyaudioop'

Your System configuration

  • Python version: 3.13
  • Pydub version: 0.25.1
  • ffmpeg or avlib?:
  • ffmpeg/avlib version:

Is there an audio file you can include to help us reproduce?

You can include the audio file in this issue - just put it in a zip file and drag/drop the zip file into the github issue.

processor.zip

ghost avatar Oct 15 '24 09:10 ghost

is ffmpeg, and version is ffmpeg version n4.4.3-2-ga54187b7d9 Copyright (c) 2000-2022 the FFmpeg developers

ghost avatar Oct 15 '24 09:10 ghost

Try installing audioop-lts and it should work.

pip install audioop-lts

taconi avatar Oct 15 '24 20:10 taconi

@taconi

Try installing audioop-lts and it should work.

pip install audioop-lts

I tried this and can confirm it worked. Thank you!!

krishnachittur avatar Oct 28 '24 19:10 krishnachittur

Changed to 3.11

bogutski avatar Jan 11 '25 05:01 bogutski

This can be fixed if the import on utils,.py is changed https://github.com/jiaaro/pydub/pull/826

I see that there are another pr adding the dependency of audioop-lts here https://github.com/jiaaro/pydub/pull/816 . I am not sure if you prefer one solution or the other.

After this change, support to python 3.13 can be added

godiard avatar Jan 13 '25 14:01 godiard

After testing my change, found some issues uisng the local file pyaudioop.py

In particular, meassurement on seconds of mp3 audio segments in a stream gives very different values compared with the library running on python3.12.

I did multiple tests and the better results are obtained usinf audioop-lts instead of the local copy of pyaudioop so I will close my own PR

godiard avatar Jan 14 '25 17:01 godiard

Basically, can someone close this, because this module is removed in 3.13+ https://peps.python.org/pep-0594/ https://github.com/TalkBank/batchalign2/issues/24 will be what I might follow, as well as https://github.com/ManimCommunity/manim/issues/3968 to see what folks use instead.

As for using the -lts suffixed package on pypi, see https://peps.python.org/pep-0625/ which they emailed me about the other day, because apparently the package name will have to match the module names in future. Good to avoid modules being published maliciously, but a pain for basic maintenance like this.

Lewiscowles1986 avatar Mar 24 '25 07:03 Lewiscowles1986