Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbol not found in flat namespace '__ZN5MeCab11createModelEPKc' #87

Closed
agilebean opened this issue Dec 13, 2022 · 6 comments
Closed

symbol not found in flat namespace '__ZN5MeCab11createModelEPKc' #87

agilebean opened this issue Dec 13, 2022 · 6 comments

Comments

@agilebean
Copy link

I have filed this issue on the tts github as bug here, but I think it can only be solved here as the error is thrown from the mecab library.

Please note that the error is thrown regardless which model or vocoder is used.

Example:
tts --text "Text for TTS" --model_name "tts_models/en/ek1/tacotron2" --vocoder_name "vocoder_models/en/vctk/hifigan_v2" --out_path output/speech.wav

throws this

ImportError: dlopen(/Users/chaehan/mambaforge/envs/tts/lib/python3.10/site-packages/MeCab/_MeCab.cpython-310-darwin.so, 0x000A): symbol not found in flat namespace '__ZN5MeCab11createModelEPKc'

Question

Could this error be related to the correct version of boost-python3 used for compiling, as is explained thoroughly here?

@polm
Copy link
Collaborator

polm commented Dec 13, 2022

This is definitely not caused by a bug in tts. However if you aren't using mecab-python3 (like, you're not working with Japanese), they shouldn't automatically install it, and it's unfortunate that they do so. Thank you for bringing this to my attention.

I am not sure exactly what mismatch causes this error. You're building mecab-python3 by doing something like this?

brew install mecab
pip install mecab-python3

If you installed boost-python3 first and then ran the above, I'm not sure how you'd get a version mismatch. Did you install or update boost-python3 after running brew install mecab or something?

Also, to clarify something for me, does brew build MeCab from source, or does it install a precompiled binary? Depending on how that works it could cause different kinds of issues.

Can you load MeCab on its own, like this? (You'll get an error without a dictionary, but that'll show there's no symbol error at least.)

import MeCab
tagger = MeCab.Tagger()

@agilebean
Copy link
Author

agilebean commented Dec 14, 2022

This is definitely not caused by a bug in tts. However if you aren't using mecab-python3 (like, you're not working with Japanese), they shouldn't automatically install it, and it's unfortunate that they do so. Thank you for bringing this to my attention.

Thanks also for posting on the TTS repo to suggest removing the mecab dependency!

I am not sure exactly what mismatch causes this error. You're building mecab-python3 by doing something like this?

brew install mecab
pip install mecab-python3

Almost correct. On the Apple Silicon (arm64) architecture, you need to

  • explicitly add the corresponding flags
  • use the homebrew version for the Apple Silicon package distribution

/opt/homebrew/bin/brew install mecab

If you installed boost-python3 first and then ran the above, I'm not sure how you'd get a version mismatch. Did you install or update boost-python3 after running brew install mecab or something?

I'm not sure either why this happens. Yes I did install boost-python3 after installing mecab with the above command for the Apple Silicon architecture.

Also, to clarify something for me, does brew build MeCab from source, or does it install a precompiled binary? Depending on how that works it could cause different kinds of issues.

That is a good point I will check, thanks.

As for pip, I made sure it compiles from source with:

ARCHFLAGS='-arch arm64' pip install --compile --use-pep517 --no-cache-dir --force mecab-python3==1.0.5

Can you load MeCab on its own, like this? (You'll get an error without a dictionary, but that'll show there's no symbol error at least.)

import MeCab
tagger = MeCab.Tagger()

Interesting!
Unexpectedly, I got the same error:

ImportError: dlopen(/Users/chaehan/mambaforge/envs/tts/lib/python3.10/site-packages/MeCab/_MeCab.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '__ZN5MeCab11createModelEPKc'

So I will try to build homebrew from source and let you know soon.

@agilebean
Copy link
Author

agilebean commented Dec 14, 2022

@polm you're a genius!
Your suggestion was right on point. I was so focused on the correct pip install that I forget about the homebrew install.
So I made sure that homebrew compiles from source:

brew reinstall --build-from-source mecab

and then rerun the pip install from source:

ARCHFLAGS='-arch arm64' pip install --compile --use-pep517 --no-cache-dir --force mecab-python3==1.0.5

Result:
It works :)

Thank you indeed.

@polm
Copy link
Collaborator

polm commented Dec 15, 2022

Thanks for confirming it worked, glad you got it running.

@polm polm closed this as completed Dec 15, 2022
@agilebean
Copy link
Author

Last addon:
I had a few more errors which all went away after I installed again all libraries with
ARCHFLAGS='-arch arm64' pip install --compile --use-pep517 --no-cache-dir --force -e .

@yin-ori
Copy link

yin-ori commented Apr 10, 2023

unfortunately it still does not work for me - I have installed mecab-python3 as per the suggestion, but if I use which mecab-python3 it will not find it. (although it has been installed successfully)
I still receive the error in the title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants