ModuleNotFoundError: No module named 'numba.decorators' When Running quick_start.py
SamuelEnzi opened this issue · comments
I've been attempting to use the project, but I'm encountering a persistent issue when trying to run quick_start.py
. Below is a detailed description of the steps I've taken and the error I'm facing. I would greatly appreciate any help or guidance you can provide to resolve this issue.
Issue Description:
Upon running quick_start.py
, I encounter a ModuleNotFoundError
related to the numba.decorators
module.
Steps to Reproduce:
- Cloned the repository:
git clone https://github.com/fatchord/WaveRNN.git
- Navigated to the WaveRNN directory:
cd WaveRNN/
- Set up a Python virtual environment:
python3 -m venv venv
- Activated the virtual environment:
source venv/bin/activate
- Installed the required dependencies from
requirements.txt
:pip install -r requirements.txt
- Installed PyTorch:
pip install torch
- Attempted to run
quick_start.py
with an input text:python quick_start.py -u --input_text "What will happen if I run this command?"
Error Encountered:
Upon running the last command, I received the following error message:
Traceback (most recent call last):
File "/home/manamana/WaveRNN/quick_start.py", line 2, in <module>
from models.fatchord_version import WaveRNN
File "/home/manamana/WaveRNN/models/fatchord_version.py", line 6, in <module>
from utils.dsp import *
File "/home/manamana/WaveRNN/utils/dsp.py", line 3, in <module>
import librosa
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/init.py", line 12, in <module>
from . import core
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/core/init.py", line 109, in <module>
from .time_frequency import * # pylint: disable=wildcard-import
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/core/time_frequency.py", line 10, in <module>
from ..util.exceptions import ParameterError
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/util/init.py", line 71, in <module>
from . import decorators
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/util/decorators.py", line 9, in <module>
from numba.decorators import jit as optional_jit
ModuleNotFoundError: No module named 'numba.decorators'
System Information
- Operating System: Ubuntu 22.04.02 LTS WSL
- Python Version: 3.10.12
- CUDA Version: 12.2
- GPU Model: NVIDIA GeForce RTX 3060
- RAM: 32GB
Complete history
manamana@ManamanaTheReal:~$ git clone https://github.com/fatchord/WaveRNN.git
Cloning into 'WaveRNN'...
remote: Enumerating objects: 932, done.
remote: Total 932 (delta 0), reused 0 (delta 0), pack-reused 932
Receiving objects: 100% (932/932), 242.13 MiB | 4.26 MiB/s, done.
Resolving deltas: 100% (525/525), done.
manamana@ManamanaTheReal:~$ cd WaveRNN/
manamana@ManamanaTheReal:~/WaveRNN$ python3 -m venv venv
manamana@ManamanaTheReal:~/WaveRNN$ source venv/bin/activate
(venv) manamana@ManamanaTheReal:~/WaveRNN$ pip install -r requirements.txt
Collecting numpy==1.22.0
Using cached numpy-1.22.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
[...]
Successfully installed annotated-types-0.6.0 audioread-3.0.1 click-8.1.7 contourpy-1.2.0 cycler-0.12.1 decorator-5.1.1 fonttools-4.44.0 inflect-7.0.0 joblib-1.3.2 kiwisolver-1.4.5 librosa-0.6.3 llvmlite-0.41.1 matplotlib-3.8.1 nltk-3.8.1 numba-0.58.1 numpy-1.22.0 packaging-23.2 pillow-10.1.0 pydantic-2.4.2 pydantic-core-2.10.1 pyparsing-3.1.1 python-dateutil-2.8.2 regex-2023.10.3 resampy-0.4.2 scikit-learn-1.3.2 scipy-1.11.3 six-1.16.0 threadpoolctl-3.2.0 tqdm-4.66.1 typing-extensions-4.8.0 unidecode-1.3.7
(venv) manamana@ManamanaTheReal:~/WaveRNN$ pip install torch
Collecting torch
Using cached torch-2.1.0-cp310-cp310-manylinux1_x86_64.whl (670.2 MB)
[...]
Installing collected packages: mpmath, sympy, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, networkx, MarkupSafe, fsspec, filelock, triton, nvidia-cusparse-cu12, nvidia-cudnn-cu12, jinja2, nvidia-cusolver-cu12, torch
Successfully installed MarkupSafe-2.1.3 filelock-3.13.1 fsspec-2023.10.0 jinja2-3.1.2 mpmath-1.3.0 networkx-3.2.1 nvidia-cublas-cu12-12.1.3.1 nvidia-cuda-cupti-cu12-12.1.105 nvidia-cuda-nvrtc-cu12-12.1.105 nvidia-cuda-runtime-cu12-12.1.105 nvidia-cudnn-cu12-8.9.2.26 nvidia-cufft-cu12-11.0.2.54 nvidia-curand-cu12-10.3.2.106 nvidia-cusolver-cu12-11.4.5.107 nvidia-cusparse-cu12-12.1.0.106 nvidia-nccl-cu12-2.18.1 nvidia-nvjitlink-cu12-12.3.52 nvidia-nvtx-cu12-12.1.105 sympy-1.12 torch-2.1.0 triton-2.1.0
(venv) manamana@ManamanaTheReal:~/WaveRNN$ python quick_start.py -u --input_text "What will happen if I run this command?"
Traceback (most recent call last):
File "/home/manamana/WaveRNN/quick_start.py", line 2, in <module>
from models.fatchord_version import WaveRNN
File "/home/manamana/WaveRNN/models/fatchord_version.py", line 6, in <module>
from utils.dsp import *
File "/home/manamana/WaveRNN/utils/dsp.py", line 3, in <module>
import librosa
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/__init__.py", line 12, in <module>
from . import core
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/core/__init__.py", line 109, in <module>
from .time_frequency import * # pylint: disable=wildcard-import
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/core/time_frequency.py", line 10, in <module>
from ..util.exceptions import ParameterError
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/util/__init__.py", line 71, in <module>
from . import decorators
File "/home/manamana/WaveRNN/venv/lib/python3.10/site-packages/librosa/util/decorators.py", line 9, in <module>
from numba.decorators import jit as optional_jit
ModuleNotFoundError: No module named 'numba.decorators'
(venv) manamana@ManamanaTheReal:~/WaveRNN$
Thank you for your time and assistance.
The error appears to be related to the version of librosa being used. To address this issue, try installing version 0.9.2 of librosa specifically.
The error appears to be related to the version of librosa being used. To address this issue, try installing version 0.9.2 of librosa specifically.
Thank you. Changing the librosa version to 0.9.2 resolved the issue.
Required codechanges for librosa 0.9.2
For it to work with librosa 0.9.2 you need to change the following lines of code:
WaveRNN/utils/dsp.py line:23 : override save_wave method with
def save_wav(x, path, sample_rate):
# Ensure the audio is in float32 format
x_float32 = x.astype(np.float32)
# Write the audio file using soundfile
sf.write(path, x_float32, sample_rate)
WaveRNN/models/fatchord_version.py line: 260 : add the method call argument self.sample_rate within the method generate
[...]
output = output[:wave_len]
output[-20 * self.hop_length:] *= fade_out
save_wav(output, save_path, self.sample_rate) #<-- line 260
self.train()
return output