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

ImportError: dlopen(/Users/myname/Library/Python/3.8/lib/python/site-packages/_Mykytea.cpython-38-darwin.so, 2): Symbol not found: __ZN5kytea10StringUtil9normalizeERKNS_11KyteaString #26

Closed
lechang-zhang opened this issue Apr 21, 2022 · 2 comments

Comments

@lechang-zhang
Copy link

lechang-zhang commented Apr 21, 2022

Thank you for providing Mykytea-python :)

I installed Mykytea-python via pip,
pip install kytea

And then wrote the code below to use the basic functionality of kytea

import Mykytea

opt = "-model /opt/homebrew/Cellar/kytea/0.4.7/share/kytea/model.bin"
mk = Mykytea.Mykytea(opt)
s = "今日はいい天気です"

for word in mk.getWS(s):
   print(word)

print(mk.getTagsToString(s))

t = mk.getTags(s)
showTags(t)

tt = mk.getAllTags(s)
showTags(tt)

But after I run my code, it threw me an importError:

Traceback (most recent call last):
File "/Users/myname/Desktop/kytea_test/test.py", line 1, in
import Mykytea
File "/Users/myname/Library/Python/3.8/lib/python/site-packages/Mykytea.py", line 15, in
import _Mykytea
ImportError: dlopen(/Users/myname/Library/Python/3.8/lib/python/site-packages/_Mykytea.cpython-38-darwin.so, 2): Symbol not found: __ZN5kytea10StringUtil9normalizeERKNS_11KyteaStringE
Referenced from: /Users/myname/Library/Python/3.8/lib/python/site-packages/_Mykytea.cpython-38-darwin.so
Expected in: flat namespace
in /Users/myname/Library/Python/3.8/lib/python/site-packages/_Mykytea.cpython-38-darwin.so

I wonder if it's because my kytea was installed under /opt/homebrew/Cellar instead of /usr/local/lib, so I moved kytea folder to /usr/local/lib but it still threw me the importError.
I'm very new in using python and searched a lot for solving this but didn't find any solution. I would be very grateful if you can help me.

@lechang-zhang lechang-zhang changed the title ImportError: dlopen(/Users/***/Library/Python/3.8/lib/python/site-packages/_Mykytea.cpython-38-darwin.so, 2): Symbol not found: __ZN5kytea10StringUtil9normalizeERKNS_11KyteaString ImportError: dlopen(/Users/myname/Library/Python/3.8/lib/python/site-packages/_Mykytea.cpython-38-darwin.so, 2): Symbol not found: __ZN5kytea10StringUtil9normalizeERKNS_11KyteaString Apr 21, 2022
@chezou
Copy link
Owner

chezou commented Apr 21, 2022

I guess you're trying to pip install via M1 macOS? If so, you need build Mykytea wheel by your own. See also #20

@lechang-zhang
Copy link
Author

Yeah you are right. I'll try to build the wheel~
Thanks a lot.

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

2 participants