Tts: ModuleNotFoundError: No module named 'TTS'

Created on 28 Feb 2020  路  13Comments  路  Source: mozilla/TTS

E:\TTS> python setup.py develop
running develop
-- Building version 0.0.1+9b97430
running egg_info
writing tts_namespace\TTS.egg-info\PKG-INFO
writing dependency_links to tts_namespace\TTS.egg-info\dependency_links.txt
writing requirements to tts_namespace\TTS.egg-info\requires.txt
writing top-level names to tts_namespace\TTS.egg-info\top_level.txt
reading manifest file 'tts_namespace\TTS.egg-info\SOURCES.txt'
writing manifest file 'tts_namespace\TTS.egg-info\SOURCES.txt'
running build_ext
Creating c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages\TTS.egg-link (link to tts_namespace)
Removing tts 0.0.1+e540a54 from easy-install.pth file
Adding TTS 0.0.1+9b97430 to easy-install.pth file

Installed e:\tts\tts_namespace
Processing dependencies for TTS==0.0.1+9b97430
Searching for phonemizer==2.2
Best match: phonemizer 2.2
Processing phonemizer-2.2-py3.8.egg
phonemizer 2.2 is already the active version in easy-install.pth
Installing phonemize-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing phonemize.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages\phonemizer-2.2-py3.8.egg
Searching for soundfile==0.10.3.post1
Best match: soundfile 0.10.3.post1
Processing soundfile-0.10.3.post1-py3.8.egg
soundfile 0.10.3.post1 is already the active version in easy-install.pth

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages\soundfile-0.10.3.post1-py3.8.egg
Searching for bokeh==1.4.0
Best match: bokeh 1.4.0
Adding bokeh 1.4.0 to easy-install.pth file
Installing bokeh-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing bokeh.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for tqdm==4.11.2
Best match: tqdm 4.11.2
Adding tqdm 4.11.2 to easy-install.pth file
Installing tqdm-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing tqdm.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for Flask==1.1.1
Best match: Flask 1.1.1
Adding Flask 1.1.1 to easy-install.pth file
Installing flask-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing flask.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for Pillow==7.0.0
Best match: Pillow 7.0.0
Adding Pillow 7.0.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for matplotlib==3.1.3
Best match: matplotlib 3.1.3
Adding matplotlib 3.1.3 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for tensorboardX==2.0
Best match: tensorboardX 2.0
Adding tensorboardX 2.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for attrdict==2.0.1
Best match: attrdict 2.0.1
Adding attrdict 2.0.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for unidecode==0.4.20
Best match: unidecode 0.4.20
Processing unidecode-0.4.20-py3.8.egg
unidecode 0.4.20 is already the active version in easy-install.pth
Installing unidecode-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing unidecode.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages\unidecode-0.4.20-py3.8.egg
Searching for librosa==0.6.2
Best match: librosa 0.6.2
Processing librosa-0.6.2-py3.8.egg
librosa 0.6.2 is already the active version in easy-install.pth

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages\librosa-0.6.2-py3.8.egg
Searching for numpy==1.15.4
Best match: numpy 1.15.4
Processing numpy-1.15.4-py3.8-win-amd64.egg
numpy 1.15.4 is already the active version in easy-install.pth
Installing f2py.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages\numpy-1.15.4-py3.8-win-amd64.egg
Searching for torch==1.4.0
Best match: torch 1.4.0
Adding torch 1.4.0 to easy-install.pth file
Installing convert-caffe2-to-onnx-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing convert-caffe2-to-onnx.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing convert-onnx-to-caffe2-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing convert-onnx-to-caffe2.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for scipy==1.4.1
Best match: scipy 1.4.1
Adding scipy 1.4.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for attrs==19.3.0
Best match: attrs 19.3.0
Adding attrs 19.3.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for segments==2.1.3
Best match: segments 2.1.3
Adding segments 2.1.3 to easy-install.pth file
Installing segments-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing segments.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for joblib==0.14.1
Best match: joblib 0.14.1
Adding joblib 0.14.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for cffi==1.14.0
Best match: cffi 1.14.0
Adding cffi 1.14.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for Jinja2==2.11.1
Best match: Jinja2 2.11.1
Adding Jinja2 2.11.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for tornado==6.0.3
Best match: tornado 6.0.3
Adding tornado 6.0.3 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for python-dateutil==2.8.1
Best match: python-dateutil 2.8.1
Adding python-dateutil 2.8.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for packaging==20.1
Best match: packaging 20.1
Adding packaging 20.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for PyYAML==5.3
Best match: PyYAML 5.3
Adding PyYAML 5.3 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for six==1.14.0
Best match: six 1.14.0
Adding six 1.14.0 to easy-install.pth file

Using c:\users\mwx\appdata\roamingpythonpython38\site-packages
Searching for Werkzeug==0.16.1
Best match: Werkzeug 0.16.1
Adding Werkzeug 0.16.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for itsdangerous==1.1.0
Best match: itsdangerous 1.1.0
Adding itsdangerous 1.1.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for Click==7.0
Best match: Click 7.0
Adding Click 7.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for kiwisolver==1.1.0
Best match: kiwisolver 1.1.0
Adding kiwisolver 1.1.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for cycler==0.10.0
Best match: cycler 0.10.0
Adding cycler 0.10.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for pyparsing==2.4.6
Best match: pyparsing 2.4.6
Adding pyparsing 2.4.6 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for protobuf==3.11.3
Best match: protobuf 3.11.3
Adding protobuf 3.11.3 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for numba==0.48.0
Best match: numba 0.48.0
Adding numba 0.48.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for resampy==0.2.2
Best match: resampy 0.2.2
Adding resampy 0.2.2 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for decorator==4.0.11
Best match: decorator 4.0.11
Adding decorator 4.0.11 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for scikit-learn==0.22.1
Best match: scikit-learn 0.22.1
Adding scikit-learn 0.22.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for audioread==2.1.8
Best match: audioread 2.1.8
Adding audioread 2.1.8 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for csvw==1.7.0
Best match: csvw 1.7.0
Adding csvw 1.7.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for clldutils==3.5.0
Best match: clldutils 3.5.0
Adding clldutils 3.5.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for regex==2020.2.20
Best match: regex 2020.2.20
Adding regex 2020.2.20 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for pycparser==2.19
Best match: pycparser 2.19
Adding pycparser 2.19 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for MarkupSafe==1.1.1
Best match: MarkupSafe 1.1.1
Adding MarkupSafe 1.1.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for setuptools==41.2.0
Best match: setuptools 41.2.0
Adding setuptools 41.2.0 to easy-install.pth file
Installing easy_install-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing easy_install.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing easy_install-3.6-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing easy_install-3.6.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for llvmlite==0.31.0
Best match: llvmlite 0.31.0
Adding llvmlite 0.31.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for uritemplate==3.0.1
Best match: uritemplate 3.0.1
Adding uritemplate 3.0.1 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for rfc3986==1.3.2
Best match: rfc3986 1.3.2
Adding rfc3986 1.3.2 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for isodate==0.6.0
Best match: isodate 0.6.0
Adding isodate 0.6.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for tabulate==0.8.6
Best match: tabulate 0.8.6
Adding tabulate 0.8.6 to easy-install.pth file
Installing tabulate-script.py script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts
Installing tabulate.exe script to C:Users\MWX\AppData\Local\Programs\Python\Python38\Scripts

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for colorlog==4.1.0
Best match: colorlog 4.1.0
Adding colorlog 4.1.0 to easy-install.pth file

Using c:\users\mwx\appdata\local\programspythonpython38\lib\site-packages
Searching for colorama==0.4.3
Best match: colorama 0.4.3
Adding colorama 0.4.3 to easy-install.pth file

Using c:\users\mwx\appdata\roamingpythonpython38\site-packages
Finished processing dependencies for TTS==0.0.1+9b97430

E:\TTS> python train.py
Traceback (most recent call last):
File "train.py", line 13, in
from TTS.datasets.TTSDataset import MyDataset
ModuleNotFoundError: No module named 'TTS'

wontfix

Most helpful comment

Messing with PYTHONPATH and sys.path is just asking for more problems in the future. The correct way to get the modules and packages visible is to install the code with pip install . or pip install -e . if you're changing the code.

All 13 comments

I guess it is windows. I've no idea. Maybe someone else would comment on that.

Same issue when trying to execute the Docker image:

$ docker run -it --rm -p 5002:5002 mozilla-tts
Traceback (most recent call last):
  File "server/server.py", line 6, in <module>
    from TTS.server.synthesizer import Synthesizer
ModuleNotFoundError: No module named 'TTS'

I am on Ubuntu and the same error occurred.

have you tried installing it as it warns you about

python setup.py install

"No module named TTS" issue happens because root folder of repository share module and files that uses this module. They are at same level. So, it needs to be separated.
My workaround. Here is docker-compose.yaml. I mount the same folder as child...

version: '2.3'                                                                                                                                         

services:                                                                                                                                              
  tts:                                                                                                                                                 
    build: .                                                                                                                                           
    volumes:.                                                                                                                                          
      - .:/tmp/tts                                                                                                                                     
      - .:/tmp/tts/TTS                                                                                                                                 
      - /media/data/Projects/datascience/tts/ru_common_voice:/audio                                                                                    

    working_dir: /tmp/tts                                                                                                                              
    stdin_open: true                                                                                                                                   
    tty: true                                                                                                                                          
    runtime: nvidia
    environment:                                                                                                                                       
      - CUDA_VISIBLE_DEVICES=0                                                                                                                         
    command: python3.6 train.py --config_path config.json

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You might also look our discourse page for further help. https://discourse.mozilla.org/c/tts

I understand this is an old issue, nevertheless if it helps anyone else add the following line to your Dockerfile and then re-build the image
ENV PYTHONPATH "${PYTHONPATH}:/srv"
The PYTHONPATH variable needs to point to the parent folder in the container (/srv in this case), not the folder where you stored the repo.

just in code add sys.path.append(PATH)
PATH is the parent directory of 'TTS'
I don't know if this is correct, but it works

Messing with PYTHONPATH and sys.path is just asking for more problems in the future. The correct way to get the modules and packages visible is to install the code with pip install . or pip install -e . if you're changing the code.

I have this problem. What is the recomended way of dealing with it.

Traceback (most recent call last):
File "server/server.py", line 6, in
from TTS.server.synthesizer import Synthesizer
ModuleNotFoundError: No module named 'TTS'

Does docker have its own internal sys.path?

error1

I don't know what I'm doing wrong but can't get rid of this error.
"python setup.py develop" execute successfully. But when I tried to check tts using train.py , it always gives me the same error. I'm using windows 7. Please help me out in this

just in code add sys.path.append(PATH)
PATH is the parent directory of 'TTS'
I don't know if this is correct, but it works

It works now. In Auguest 2020, need a little tweaks
ENV PYTHONPATH "${PYTHONPATH}:/srv/app"
because the TTS app is located in /srv/app But the server.py don't use -c flag anymore.. use --tts_config for instead. but you will see some parameter errors that:

root@a2f72c53d1c6:/srv/app/TTS# python3.6 server/server.py --tts_config server/conf.json 
 > Loading TTS model ...
 | > model config:  server/conf.json
 | > checkpoint file:  None
Traceback (most recent call last):
  File "server/server.py", line 62, in <module>
    synthesizer = Synthesizer(args)
  File "/srv/app/TTS/server/synthesizer.py", line 36, in __init__
    self.config.use_cuda)
  File "/srv/app/TTS/server/synthesizer.py", line 53, in load_tts
    self.use_phonemes = self.tts_config.use_phonemes
AttributeError: 'AttrDict' object has no attribute 'use_phonemes'

I think the config.json is a bit outdated. I'm new to TTS. Don't know what parameters in config.json mean...

just in code add sys.path.append(PATH)
PATH is the parent directory of 'TTS'
I don't know if this is correct, but it works

It works now. In Auguest 2020, need a little tweaks
ENV PYTHONPATH "${PYTHONPATH}:/srv/app"
because the TTS app is located in /srv/app But the server.py don't use -c flag anymore.. use --tts_config for instead. but you will see some parameter errors that:

root@a2f72c53d1c6:/srv/app/TTS# python3.6 server/server.py --tts_config server/conf.json 
 > Loading TTS model ...
 | > model config:  server/conf.json
 | > checkpoint file:  None
Traceback (most recent call last):
  File "server/server.py", line 62, in <module>
    synthesizer = Synthesizer(args)
  File "/srv/app/TTS/server/synthesizer.py", line 36, in __init__
    self.config.use_cuda)
  File "/srv/app/TTS/server/synthesizer.py", line 53, in load_tts
    self.use_phonemes = self.tts_config.use_phonemes
AttributeError: 'AttrDict' object has no attribute 'use_phonemes'

I think the config.json is a bit outdated. I'm new to TTS. Don't know what parameters in config.json mean...

You are providing it wrong config.json file. Instead of config.json file from server folder provide it complete path of config.json file of your root TTS directory.

Hope it helps. :)

@xros

Was this page helpful?
0 / 5 - 0 ratings

Related issues

WeberJulian picture WeberJulian  路  6Comments

erogol picture erogol  路  8Comments

vcjob picture vcjob  路  7Comments

xoxoxo13102020 picture xoxoxo13102020  路  9Comments

erogol picture erogol  路  11Comments