tortoise-tts icon indicating copy to clipboard operation
tortoise-tts copied to clipboard

ModuleNotFoundError: No module named 'tortoise.models'

Open Fluffpumpkin opened this issue 3 years ago • 2 comments

When I try to run python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast I get the error

Traceback (most recent call last):
  File "C:\Users\surfl\tortoise-tts\tortoise\do_tts.py", line 7, in <module>
    from api import TextToSpeech, MODELS_DIR
  File "C:\Users\surfl\tortoise-tts\tortoise\api.py", line 12, in <module>
    from tortoise.models.classifier import AudioMiniEncoderWithClassifierHead
ModuleNotFoundError: No module named 'tortoise.models'

I am running on anaconda on windows 11 and I have tortoise installed. Does anyone know how to fix the issue?

Fluffpumpkin avatar Nov 18 '22 16:11 Fluffpumpkin

To fix this issue you have to edit the files that import modules from folders, so for example open the app.py file and there will be a from tortoise.models.classifier import AudioMiniEncoderWithClassifierHead change it to from models.classifier import AudioMiniEncoderWithClassifierHead you have to do this to every .py file that imports modules from this repo, so most .py in models folder and in utils folder, basic rule remove the tortoise. at the beginning and you should be good

TrophiHunter avatar Dec 19 '22 22:12 TrophiHunter

I ran into the same issue and I first tried what TrophiHunter suggested, but I thought I might have done something wrong if I were to change all the imports by myself. I then realized I had not run python setup.py install in the command line yet. So I suggest running this line first, if not done already.

jmpion avatar Dec 24 '22 14:12 jmpion

I already did what TrophiHunter suggested and it definitely worked. I wanna say thank you

Fluffpumpkin avatar Jan 04 '23 18:01 Fluffpumpkin

I have this issue and have tried what TrophiHunter and jmpion have mentioned with nothing changed. Can someone provide some assistance, please?

ProducingIt avatar May 31 '23 03:05 ProducingIt

So I did find a solution, I just reinstalled it. I deleted the folder called tortoise-tts under anaconda3 on Windows, then I went to the folder named envs still under anaconda3 and deleted a folder with the same name, tortoise-tts, again. I followed these steps to install it under an Anaconda cmd prompt window: conda create --name tortoise-tts python=3.9

conda activate tortoise-tts

conda install -n base conda-forge::mamba

mamba install pandas

cd anaconda3

conda install torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

conda install -c conda-forge pysoundfile

git clone https://github.com/neonbjb/tortoise-tts.git

cd tortoise-tts

[From Requirements.txt delete all NUMBA entries and llvmlite entry. Then change NUMPY to 1.20.3 and SCIPY to 1.10.1]

python -m pip install -r ./requirements.txt

conda install numba

python setup.py install

Credits to Emit.Reviews from Youtube.

ProducingIt avatar May 31 '23 23:05 ProducingIt

To fix this issue you have to edit the files that import modules from folders, so for example open the app.py file and there will be a from tortoise.models.classifier import AudioMiniEncoderWithClassifierHead change it to from models.classifier import AudioMiniEncoderWithClassifierHead you have to do this to every .py file that imports modules from this repo, so most .py in models folder and in utils folder, basic rule remove the tortoise. at the beginning and you should be good

Thanks. the path of "pip install xx" is different from the another sofeware's libarary I used. Just copy the xx to the another libarary then it works

ERICWANGHONG avatar Aug 09 '23 10:08 ERICWANGHONG

1.10.1

We don't need pytorch torchvision transformers?

Original steps:

conda create --name tortoise python=3.9 numba inflect
conda activate tortoise
conda install -n base conda-forge::mamba
mamba install pandas
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
conda install transformers=4.29.2
git clone https://github.com/neonbjb/tortoise-tts.git
cd tortoise-tts
python setup.py install

What I get from your steps

conda create --name tortoise python=3.9 inflect //we are not using numba I guess
conda activate tortoise
conda install -n base conda-forge::mamba
mamba install pandas
cd anaconda3 // is this directory created?
conda install torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
conda install -c conda-forge pysoundfile
git clone https://github.com/neonbjb/tortoise-tts.git
cd tortoise-tts
python -m pip install -r ./requirements.txt
python setup.py install

New requirements.txt


tqdm
rotary_embedding_torch
transformers==4.31.0
tokenizers
inflect
progressbar
einops==0.4.1
unidecode
scipy==1.10.1
librosa==0.9.1
ffmpeg
numpy==1.20.3
torchaudio
threadpoolctl
appdirs
nbconvert==5.3.1
tornado==4.2
pydantic==1.9.1
deepspeed==0.8.3
py-cpuinfo
hjson
psutil
sounddevice

binarydepth avatar Jan 15 '24 13:01 binarydepth

did you launch it from tortoise folder or from scripts folder?

RedHat819 avatar Jul 18 '24 15:07 RedHat819