chaquo / chaquopy

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

pyinform issue #1071

Open VWE22 opened 6 months ago

VWE22 commented 6 months ago

I'm working on a project that uses the lib "pyinform". I don't have any issue when I install the lib but at the moment of execution I have the above message appear:

OSError: dlopen failed: library "libm.so.6" not found: needed by /data/data/com.example.a_example/files/chaquopy/AssetFinder/requirements/pyinform/inform-1.0.0/lib/linux-x86_64/libinform.so.1.0.0 in namespace clns-6

mhsmith commented 5 months ago

The none-any wheel of this package on PyPI contains pre-compiled libraries for Linux, Mac and Windows, but none of those will work on Android.

If you'd like to try building an Android wheel yourself, follow the instructions here. And if you're successful, please make a pull request so we can add the package to the public repository.

If anyone else wants this package too, let us know by clicking the thumbs-up button above.

VWE22 commented 5 months ago

Hello, Thanks for your answer. I'm trying to follow the instruction [to build pyinform] but I have this error:

Installing NDK: this may take several minutes /home/ab/Desktop/android-sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/*/bin/llvm-ar does not exist

BR

mhsmith commented 5 months ago

I've had several other reports of this NDK installation issue, so I've created a new issue for it: #1084. Please continue the discussion there.

mhsmith commented 5 months ago

Originally posted by @VWE22 in https://github.com/chaquo/chaquopy/issues/1084#issuecomment-1914464994

The NDK exist now with the command that you give me. Now I'm facing another error:

~/Desktop/chaquopy/server/pypi$ ./build-wheel.py --python 3.8 --abi arm64-v8a pyinform
build-wheel: cd /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0
build-wheel: rm -rf /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a
build-wheel: mkdir -p /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a
build-wheel: Using cached sdist
build-wheel: tar -C /tmp/build-wheel-80jf_j1v -xf pyinform-0.2.0.tar.gz
build-wheel: mv /tmp/build-wheel-80jf_j1v/pyinform-0.2.0 /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/src
build-wheel: rm -rf /tmp/build-wheel-80jf_j1v
build-wheel: mkdir -p /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements
build-wheel: mkdir -p /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include
build-wheel: mkdir -p /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib
build-wheel: unzip -q -d /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy /home/abba/Desktop/chaquopy/maven/com/chaquo/python/target/3.8.18-0/target-3.8.18-0-arm64-v8a.zip include/* jniLibs/*
build-wheel: mv /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/jniLibs/arm64-v8a/* /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib
build-wheel: rm -r /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/jniLibs
build-wheel: ln -s libpython3.8.so /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libpython3..so
build-wheel: ln -s libssl_chaquopy.so /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libssl.so
build-wheel: ln -s libcrypto_chaquopy.so /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libcrypto.so
build-wheel: ln -s libsqlite3_chaquopy.so /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libsqlite3.so
build-wheel: /home/abba/Desktop/chaquopy/server/pypi/build/_bootstrap/3.8/bin/pip --version
build-wheel: mkdir -p /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/env
build-wheel: python3.8 -m venv --without-pip /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/env
build-wheel: /home/abba/Desktop/chaquopy/server/pypi/build/_bootstrap/3.8/bin/pip --python /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/env/bin/python install wheel 'setuptools >= 40.8.0'
Collecting wheel
  Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/c7/c3/55076fc728723ef927521abaa1955213d094933dc36d4a2008d5101e1af5/wheel-0.42.0-py3-none-any.whl.metadata
  Using cached wheel-0.42.0-py3-none-any.whl.metadata (2.2 kB)
Collecting setuptools>=40.8.0
  Obtaining dependency information for setuptools>=40.8.0 from https://files.pythonhosted.org/packages/55/3a/5121b58b578a598b269537e09a316ad2a94fdd561a2c6eb75cd68578cc6b/setuptools-69.0.3-py3-none-any.whl.metadata
  Using cached setuptools-69.0.3-py3-none-any.whl.metadata (6.3 kB)
Using cached wheel-0.42.0-py3-none-any.whl (65 kB)
Using cached setuptools-69.0.3-py3-none-any.whl (819 kB)
Installing collected packages: wheel, setuptools
Successfully installed setuptools-69.0.3 wheel-0.42.0
build-wheel: abi=arm64-v8a; api_level=21; prefix=/home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy; . /home/abba/Desktop/chaquopy/server/pypi/../../target/build-common.sh; export
build-wheel: mkdir -p /home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/wrappers
Traceback (most recent call last):
  File "/home/abba/.local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/home/abba/.local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/home/abba/.local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/env/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
  File "/home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/env/lib/python3.8/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
    self.run_setup()
  File "/home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/env/lib/python3.8/site-packages/setuptools/build_meta.py", line 480, in run_setup
    super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
  File "/home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/env/lib/python3.8/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 16, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'LICENSE'
Traceback (most recent call last):
  File "/home/abba/.local/lib/python3.10/site-packages/build/__init__.py", line 466, in _handle_backend
    yield
  File "/home/abba/.local/lib/python3.10/site-packages/build/__init__.py", line 356, in get_requires_for_build
    return set(get_requires(config_settings))
  File "/home/abba/.local/lib/python3.10/site-packages/pyproject_hooks/_impl.py", line 166, in get_requires_for_build_wheel
    return self._call_hook('get_requires_for_build_wheel', {
  File "/home/abba/.local/lib/python3.10/site-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/home/abba/.local/lib/python3.10/site-packages/build/__init__.py", line 302, in _runner
    self._hook_runner(cmd, cwd, extra_environ)
  File "/home/abba/.local/lib/python3.10/site-packages/pyproject_hooks/_impl.py", line 59, in default_subprocess_runner
    check_call(cmd, cwd=cwd, env=env)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/abba/Desktop/chaquopy/server/pypi/packages/pyinform/build/0.2.0/cp38-cp38-android_21_arm64_v8a/env/bin/python', '/home/abba/.local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py', 'get_requires_for_build_wheel', '/tmp/tmptob__odm']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/abba/Desktop/chaquopy/server/pypi/./build-wheel.py", line 955, in <module>
    BuildWheel().main()
  File "/home/abba/Desktop/chaquopy/server/pypi/./build-wheel.py", line 112, in main
    self.unpack_and_build()
  File "/home/abba/Desktop/chaquopy/server/pypi/./build-wheel.py", line 173, in unpack_and_build
    self.create_build_env()
  File "/home/abba/Desktop/chaquopy/server/pypi/./build-wheel.py", line 274, in create_build_env
    requires_for_build = self.builder.get_requires_for_build("wheel")
  File "/home/abba/.local/lib/python3.10/site-packages/build/__init__.py", line 355, in get_requires_for_build
    with self._handle_backend(hook_name):
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/abba/.local/lib/python3.10/site-packages/build/__init__.py", line 474, in _handle_backend
    raise BuildBackendException(  # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke get_requires_for_build_wheel

The yaml file is:

{% set version = "0.2.0"%}

package:
  name: pyinform
  version: {{ version }}

And I have a LICENSE file in the directory:

~/Desktop/PyInform$ ls ../chaquopy/server/pypi/packages/pyinform/
build  
LICENSE  
meta.yaml

Thanks

mhsmith commented 5 months ago

Apparently they forgot to include the LICENSE file in their sdist on PyPI, even though their setup.py script uses it. I suggest you report that to them.

Meanwhile, you can work around this by adding the LICENSE file yourself. See "If any changes are needed to make the build work" in the build-wheel README.