-
Notifications
You must be signed in to change notification settings - Fork 169
Description
I am trying to build an app which requires python scripts that need to import netcdf4. When I do "pip install netcdf4" as seen in the python block in the build.gradle file below and try to build the app in Android Studio, I get:
"CCompiler.compile: Chaquopy cannot compile native code"
among other errors.
As such it was recommended to me by mhsmith that I build a wheel file for netcdf4 following the instructions at:
https://github.com/chaquo/chaquopy/tree/master/server/pypi
For reference, I am creating the wheel file on this VM:
Linux debian 4.19.0-23-amd64 #1 SMP Debian 4.19.269-1 (2022-12-20) x86_64 GNU/Linux
I have had to make a few minor mods to the build-wheel.py file and get to this part of build-wheel.py --
run(f"{self.pip} wheel --no-deps "
# --no-clean doesn't currently work: see env/python/sitecustomize.py.
#
# We pass -v unconditionally, because we always want to see the build process
# output. --global-option=-vv enables additional distutils logging.
f"-v {'--global-option=-vv ' if self.verbose else ''}"
f"-e .")
and it outputs a string of errors such as the following --
Building wheel for numpy (setup.py): still running...
Building wheel for numpy (setup.py): finished with status 'error'
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [4890 lines of output]
Running from numpy source directory.
blas_opt_info:
blas_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/home/me/PYTHON3.8/lib', '/usr/loc
al/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
blis_info:
customize UnixCCompiler
libraries blis not found in ['/home/me/PYTHON3.8/lib', '/usr/local
/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
openblas_info:
openblas_info:
customize UnixCCompiler
customize UnixCCompiler
libraries openblas not found in ['/home/me/PYTHON3.8/lib', '/usr/l
ocal/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries tatlas not found in ['/home/me/PYTHON3.8/lib', '/usr/loc
al/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
etc.
...
However, I do see libmkl_rt.so.2 in /home/me/PYTHON3.8/lib. How can I make build-wheel.py see it? Via "LDFLAGS", or "LD_LIBRARY_PATH"? Regarding openblas, I built it 'by hand' and it installed to /opt/OpenBLAS/lib. Again, how to make build-wheel.py see this path?
Below is the portion of build.gradle that should be relevant--
python{
version "3.8"
// version "3.11" -- this version fails gradle syncing so stick with v3.8
//testing version "3.9"
pip {
install "numpy"
// install "netcdf4-python"
install "netcdf4"
}
}
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'com.chaquo.python' version '14.0.2' apply false
}
Build log error from Android Studio:
Let me know if I need to add more to make this understandable.
Thanks much.