-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
I am running in Mac OS M2 Chip in conda env
I have tried to build new case sensitive volumen called 'Playpen'.
ModuleNotFoundError: No module named 'mecab'
ImportError: Japanese requires mecab-python3 and unidic-lite (conflict with python-mecab-ko / MeCab package)
I am trying to run the following command.
$ melo “안녕” output.wav --language KR
After following this instruction
git clone https://github.com/myshell-ai/MeloTTS.git
cd MeloTTS
pip install -e .
python -m unidic download
Text split to sentences.
“안녕”
===========================
0%| | 0/1 [00:00<?, ?it/s]you have to install python-mecab-ko. install it...
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid usingtokenizersbefore the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
so when I run first time.
python-mecab-ko is forced to install
After this second run
$ melo “안녕” output.wav --language KR
/Volumes/Playpen/MeloTTS/melo/main.py:27: UserWarning: You specified a speaker but the language is English.
warnings.warn('You specified a speaker but the language is English.')
/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/librosa/util/files.py:10: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import resource_filename
Traceback (most recent call last):
File "/Volumes/Playpen/MeloTTS/melo/text/japanese.py", line 12, in
import MeCab
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/MeCab/init.py", line 1, in
from .mecab import MeCab, MeCabError, mecabrc_path
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/MeCab/mecab.py", line 9, in
from mecab.types import Dictionary, Morpheme
ModuleNotFoundError: No module named 'mecab'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/robbyahn/miniconda3/envs/openvoice/bin/melo", line 7, in
sys.exit(main())
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/click/core.py", line 1161, in call
return self.main(*args, **kwargs)
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/click/core.py", line 1082, in main
rv = self.invoke(ctx)
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/click/core.py", line 788, in invoke
return __callback(*args, **kwargs)
File "/Volumes/Playpen/MeloTTS/melo/main.py", line 28, in main
from melo.api import TTS
File "/Volumes/Playpen/MeloTTS/melo/api.py", line 13, in
from . import utils
File "/Volumes/Playpen/MeloTTS/melo/utils.py", line 13, in
from melo.text.cleaner import clean_text
File "/Volumes/Playpen/MeloTTS/melo/text/cleaner.py", line 1, in
from . import chinese, japanese, english, chinese_mix, korean, french, spanish
File "/Volumes/Playpen/MeloTTS/melo/text/japanese.py", line 14, in
raise ImportError("Japanese requires mecab-python3 and unidic-lite.") from e
ImportError: Japanese requires mecab-python3 and unidic-lite.
After this, if I tried to run english version
% melo "Text to read" output.wav
/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/librosa/util/files.py:10: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import resource_filename
Traceback (most recent call last):
File "/Volumes/Playpen/MeloTTS/melo/text/japanese.py", line 12, in
import MeCab
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/MeCab/init.py", line 1, in
from .mecab import MeCab, MeCabError, mecabrc_path
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/MeCab/mecab.py", line 9, in
from mecab.types import Dictionary, Morpheme
ModuleNotFoundError: No module named 'mecab'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/robbyahn/miniconda3/envs/openvoice/bin/melo", line 7, in
sys.exit(main())
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/click/core.py", line 1161, in call
return self.main(*args, **kwargs)
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/click/core.py", line 1082, in main
rv = self.invoke(ctx)
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/robbyahn/miniconda3/envs/openvoice/lib/python3.9/site-packages/click/core.py", line 788, in invoke
return __callback(*args, **kwargs)
File "/Volumes/Playpen/MeloTTS/melo/main.py", line 28, in main
from melo.api import TTS
File "/Volumes/Playpen/MeloTTS/melo/api.py", line 13, in
from . import utils
File "/Volumes/Playpen/MeloTTS/melo/utils.py", line 13, in
from melo.text.cleaner import clean_text
File "/Volumes/Playpen/MeloTTS/melo/text/cleaner.py", line 1, in
from . import chinese, japanese, english, chinese_mix, korean, french, spanish
File "/Volumes/Playpen/MeloTTS/melo/text/japanese.py", line 14, in
raise ImportError("Japanese requires mecab-python3 and unidic-lite.") from e
ImportError: Japanese requires mecab-python3 and unidic-lite.
Then I should reset mecab to let english version working.
Remove the wrong packages:
pip uninstall -y mecab mecab-python3 python-mecab-ko python-mecab-ko-dic
Make sure the native MeCab is installed on macOS:
brew install mecab mecab-ko mecab-ko-dic
Install the correct binding:
pip install --no-cache-dir mecab-python3
Test again:
python -c "import MeCab; print(MeCab.Tagger('-Owakati').parse('안녕하세요'))"
If it works, you’ll see tokenized text (e.g. 안녕 하세요 \n).