audiocraft icon indicating copy to clipboard operation
audiocraft copied to clipboard

ModuleNotFoundError: No module named 'soundfile'

Open mettetsystems opened this issue 2 years ago • 7 comments

The Application will not start. I received this output:

C:\Users{ }\MusicGen\audiocraft>python app.py Traceback (most recent call last): File "C:\Users{ }\MusicGen\audiocraft\app.py", line 12, in from audiocraft.models import MusicGen File "C:\Users{ }\MusicGen\audiocraft\audiocraft_init_.py", line 8, in from . import data, modules, models File "C:\Users{ }\MusicGen\audiocraft\audiocraft\data_init_.py", line 8, in from . import audio, audio_dataset File "C:\Users{ }\MusicGen\audiocraft\audiocraft\data\audio.py", line 18, in import soundfile ModuleNotFoundError: No module named 'soundfile'

Same Error running the application in a virtual environment and the host environment.

mettetsystems avatar Jun 11 '23 13:06 mettetsystems

looks like installation error

i would directly install into drive not into c users

i have a step by step workflow here : https://youtu.be/v-YpvPkhdO4

FurkanGozukara avatar Jun 11 '23 14:06 FurkanGozukara

The error message you received indicates that the module 'soundfile' is not installed in your Python environment. The 'soundfile' module is likely a dependency of your application, and it needs to be installed for your application to work properly.

To resolve this issue, you can follow these steps:

  1. Make sure you have the correct version of Python installed. Check that the version of Python you are using matches the requirements of your application.

  2. Activate your virtual environment if you are using one. Run the appropriate command based on your operating system to activate the virtual environment. For example, on Windows, you can use the command:

    venv\Scripts\activate
    
  3. Install the 'soundfile' module in your Python environment. Open a command prompt or terminal, and use the following command:

    pip install soundfile
    

    This command will download and install the 'soundfile' module from the Python Package Index (PyPI).

  4. After the installation is complete, try running your application again:

    python app.py
    

    The 'soundfile' module should now be found, and your application should start without the previous error.

If you're still encountering issues, ensure that all the necessary dependencies for your application are installed correctly. You may need to check the documentation or requirements file for your application to determine the complete list of dependencies and install them accordingly.

CHUNG-HAO avatar Jun 11 '23 15:06 CHUNG-HAO

I installed it manually, so perhaps that's why I didn't have this issue.

Assuming that you installed the package properly, I suspect that requirements.txt should add soundfile since torchaudio requires it on windows systems.

As the comment above suggests, just installing it (be mindful of any virtual environments) would be enough.

If you have more problems you can check the setup scripts that are compatible with this project: https://github.com/rsxdalv/one-click-installers-tts/blob/main/webui.py#LL59C14-L59C35

rsxdalv avatar Jun 12 '23 13:06 rsxdalv

I had the same error except it was MusicGen not soundfile. It was a little weird cause I didn't have this problem with 0.0.1.

Installing MusicGen did not solve this problem:

Successfully installed MusicGen-0.0.1 jsonpickle-3.0.1 more-itertools-9.1.0 music21-8.3.0 webcolors-1.13 youtube-dl-2021.12.17

C:\ai\AudioCraft>python app.py Traceback (most recent call last): File "C:\ai\AudioCraft\app.py", line 14, in from audiocraft.models import MusicGen ImportError: cannot import name 'MusicGen' from 'audiocraft.models' (unknown location)

SChalice avatar Jun 12 '23 18:06 SChalice

You might have installed https://pypi.org/project/musicgen/ which is completely unrelated except by name. Sounds like a separate problem, did you run pip install audiocraft?

rsxdalv avatar Jun 12 '23 19:06 rsxdalv

I too am having this issue, I've also installed and uninstalled soundfile multiple times to no avail. It's really got me puzzled. Since i can clearly see the module in the site-packages folder, but it still doesn't detect that it's there.

Also when I reinstalled audiocraft and ran pip install -e . it shows this: Requirement already satisfied: soundfile>=0.10.2 in c:\users\daydr\miniconda3\lib\site-packages (from librosa->audiocraft==0.0.2a1) (0.12.1)

I'm at a loss. ¯|-(ツ)-|¯

Edit: I found after banging my head against the keyboard and monitor for what seemed like a week. I found that for some reason it's not seeing the files inside the "site-packages" folder but instead is looking for them in the "Lib" folder.

After moving the modules from the "site packages" folder to "Lib" it seemed to work.

Daydricoldsmith avatar Jun 14 '23 22:06 Daydricoldsmith

cool... update can solve the issue

CHUNG-HAO avatar Jun 17 '23 15:06 CHUNG-HAO

cool... update can solve the issue you mean update soundfile module, right?

StantonLau avatar Jul 13 '23 18:07 StantonLau

i first install this module in conda environment , it does not work. but when i use commend pip install soundfile. it is successful and the code could run

StantonLau avatar Jul 13 '23 18:07 StantonLau