chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
841 stars 133 forks source link

please update supported spacy version to 3.x #639

Open jaggadas opened 2 years ago

jaggadas commented 2 years ago
mhsmith commented 2 years ago

Why specifically do you need the new version? What happens if you try to use the existing version (2.2.3)?

jaggadas commented 2 years ago

Why specifically do you need the new version? What happens if you try to use the existing version (2.2.3)?

I need to run NER on hindi script, which is supported only on spacy 3.x

mhsmith commented 2 years ago

OK, thanks for the information. We won't be updating this package in the near future, but I'll update this issue when we do. And if anyone else needs a new version of this package, please click the thumbs up button above, and post a comment explaining why you need it.

willaim-walmart commented 2 years ago

It would be beneficial to have spacy 3.x to be able to run models trained using 3.x. You aren't able to load v3 models using v2.

mhsmith commented 2 years ago

The package build tool is now open-source, so if you'd like to try building the new version yourself, follow the instructions here. Spacy only required a small patch, so the update should not be too difficult.

if you're successful, please make a pull request so we can add the new version to the public repository.

ptoews commented 3 months ago

The included spacy version 2.2.3 does not work on python 3.10.

I tried following the linked instructions to build 3.7.5 by myself, and got to this error:

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.10 from "/home/philipp/Downloads/chaquopy/server/pypi/packages/spacy/build/3.7.5/cp310-cp310-android_21_x86_64/env/bin/python"
  * The NumPy version is: "1.26.2"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: /lib/x86_64-linux-gnu/libm.so: invalid ELF header

Here is my command: ./build-wheel.py --python 3.10 --abi x86_64 spacy I downloaded this wheel to the dist folder: https://chaquo.com/pypi-13.1/numpy/numpy-1.26.2-0-cp310-cp310-android_21_x86_64.whl

I'm not experienced here, so maybe someone can give me a hint.

mhsmith commented 3 months ago

The build script is probably importing NumPy to find the location of its header files. The usual workaround for this is to set __NUMPY_SETUP__, as in packages/astropy/patches/chaquopy.patch.

For advice on testing this, see "If any changes are needed to make the build work" in pypi/README.md.

ptoews commented 3 months ago

That seems to have worked, but now this is the next error: build-wheel: Error: /home/philipp/Downloads/chaquopy/server/pypi/packages/spacy/build/3.7.5/cp310-cp310-android_21_x86_64/fix_wheel/spacy/matcher/levenshtein.so is linked against unknown library 'libm.so.6'.

mhsmith commented 3 months ago

I don't remember anything about spacy's build process, so I can't be very specific. But this error usually means that either something is using the build system's own compiler rather than the Android compiler, or there are references to /lib or /usr/lib on a compiler command line. Search your build log to find where this is happening, and then see https://github.com/chaquo/chaquopy/issues/823#issuecomment-1560712208 for advice.