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

Add KYTEA_DIR environment variable to build with kytea at arbitrary path #20

Merged
merged 1 commit into from
Feb 17, 2022

Conversation

maxhgerlach
Copy link
Contributor

This change would enable me to build this wrapper on my Mac (arm64-based) via

$ brew install kytea
$ KYTEA_DIR=$(brew --prefix) make all

@chezou
Copy link
Owner

chezou commented Feb 14, 2022

@maxhgerlach Thanks for your contribution. Can you check CI failure?

@maxhgerlach
Copy link
Contributor Author

maxhgerlach commented Feb 15, 2022

Hi @chezou, the failure doesn't obviously look related to my change:

2022-02-14T16:45:38.2314086Z     + sh -c 'yum install -y wget && wget http://www.phontron.com/kytea/download/kytea-0.4.7.tar.gz && tar zxf kytea-0.4.7.tar.gz && pushd kytea-0.4.7 && autoreconf -i && ./configure && make && make install && ldconfig && popd && rm -r kytea-0.4.7 && swig -Wall -c++ -python -shadow -I/usr/local/include lib/kytea/mykytea.i
2022-02-14T16:45:38.2314811Z '
2022-02-14T16:45:53.8305928Z https://vault.centos.org/centos/6/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2600:1f13:2e7:2901:d2b0:c3b2:9347:934c: Cannot assign requested address"
2022-02-14T16:45:53.8306478Z Trying other mirror.
2022-02-14T16:45:53.8306880Z Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

Apparently it couldn't reach some CentOS repository to install wget from. I don't immediately understand the setup here: Is it running a CentOS container on an ubuntu-20.04 VM?

@chezou
Copy link
Owner

chezou commented Feb 15, 2022

Ah, okay. Let me take a look.

@chezou
Copy link
Owner

chezou commented Feb 15, 2022

It turns out the issue was observed in another repository.
actions/runner-images#2264

Let me wait until it recovers.

@chezou
Copy link
Owner

chezou commented Feb 15, 2022

Made a change to build arm64 wheels.
#21

Can you rebase to current master branch?

@chezou
Copy link
Owner

chezou commented Feb 17, 2022

@maxhgerlach btw, I've released new version including arm64 wheel. Let me know if it works on your environment. https://pypi.org/project/kytea/0.1.7/

@chezou
Copy link
Owner

chezou commented Feb 17, 2022

CI passed 🎉 Will merge.

@chezou chezou merged commit 9bf1f8f into chezou:master Feb 17, 2022
@maxhgerlach
Copy link
Contributor Author

Hi @chezou, sorry for the delay... Thanks so much for merging this and releasing M1-compatible wheels! I can confirm that version 0.1.7 from PyPI works fine on my Mac (Python 3.9 built for arm64, macOS 12.2).

@maxhgerlach maxhgerlach deleted the kytea-dir branch February 17, 2022 11:14
@chezou
Copy link
Owner

chezou commented Feb 17, 2022

Thanks for your confirming! Appreciate it!

@maxhgerlach
Copy link
Contributor Author

Oops, actually I think I messed up before, actually I am getting import errors. The wheel should be independent of a system install of the kytea C++ library, right?

(devel-macos-arm64-tf26) max@mm1p:~$ pip install --no-cache -vU kytea
Using pip 22.0.3 from .../devel-macos-arm64-tf26/lib/python3.9/site-packages/pip (python 3.9)
Collecting kytea
  Downloading kytea-0.1.7-cp39-cp39-macosx_11_0_arm64.whl (145 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 146.0/146.0 KB 5.4 MB/s eta 0:00:00
Installing collected packages: kytea
Successfully installed kytea-0.1.7
(devel-macos-arm64-tf26) max@mm1p:~$ python -c 'import Mykytea'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../devel-macos-arm64-tf26/lib/python3.9/site-packages/Mykytea.py", line 15, in <module>
    import _Mykytea
ImportError: dlopen(.../devel-macos-arm64-tf26/lib/python3.9/site-packages/_Mykytea.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '__ZN5kytea10StringUtil9normalizeERKNS_11KyteaStringE'

@chezou
Copy link
Owner

chezou commented Feb 17, 2022

Hmm, looks like the wheel doesn't work properly. Unfortunately, I don't have M1 mac, so I'm not sure why delocate doesn't work appropriately.

@chezou
Copy link
Owner

chezou commented Feb 17, 2022

@maxhgerlach Just in case, can you re-install by using --force-reinstall option? https://stackoverflow.com/a/69975866

Nvm, I confirmed another person that he can't import with the wheel. Will drop the arm64 wheel later.

chezou added a commit that referenced this pull request Feb 18, 2022
Since there is a report that arm64 wheel doesn't work properly, stop
building arm64 macOS wheel.
#20 (comment)

This may be an issue around repair wheel with delocate, but can't tackle
it since the maintainer doesn't have the environment.
https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
@chezou chezou mentioned this pull request Feb 18, 2022
@maxhgerlach
Copy link
Contributor Author

Oof, cibuildwheel seems to be quite tricky indeed on macOS.

Would it help maybe to link Kytea statically to avoid the intricacies needed for delocate-wheel? Homebrew at least provides a libkytea.a next to the dylib.

$ ls -l $(brew --prefix kytea)/lib
total 3344
-r--r--r--  1 max  admin   562976 Feb 17 16:48 libkytea.0.dylib
-r--r--r--  1 max  admin  1146560 Dec 18  2014 libkytea.a
lrwxr-xr-x  1 max  admin       16 Dec 18  2014 libkytea.dylib -> libkytea.0.dylib
drwxr-xr-x  3 max  admin       96 Feb 17 16:48 pkgconfig

@chezou
Copy link
Owner

chezou commented Feb 18, 2022

Since I don't have M1 mac so I can't test, but I guess the root cause is same as fugashi facing polm/fugashi#55 (comment)

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

Successfully merging this pull request may close these issues.

2 participants