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

Scipy is not installed due to "Error: 'numpy' must be installed before running the build." #2509

Closed
5 tasks
killangell opened this issue Oct 17, 2021 · 14 comments
Closed
5 tasks

Comments

@killangell
Copy link

Checklist

  • the issue is indeed a bug and not a support request
  • issue doesn't already exist: https://github.com/kivy/python-for-android/issues
  • I have a short, runnable example that reproduces the issue
  • I reproduced the problem with the latest development version (p4a.branch = develop)
  • I used the grave accent (aka backticks) to format code or logs when appropriated

Versions

  • Python: 3.8
  • OS:
  • Kivy:
  • Cython:
  • OpenJDK:

kivy@kivy-virtual-machine:~/work/project/biga_futures/package$ p4a --version
2021.09.05

Description

Scipy is pending on numpy as I saw scipy recipe below:

depends = ['setuptools', 'cython', 'numpy', 'lapack']

It's failed been installed for error below, more logs see Logs section.
"Error: 'numpy' must be installed before running the build."

buildozer.spec

Command:
p4a apk --private $HOME/work/project/biga_futures/ --package=org.kivy.biga_futures --name "biga_futures" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy,pandas,typing_extensions,chardet,requests,urllib3,psutil,jwt,cryptography,numpy,scipy --permission PERMISSIONS INTERNET

No matter numpy is in the '--requirements' or not, nothing different.

Spec file:

// REPLACE ME: Paste your buildozer.spec file here

Logs

[INFO]: pandas said it is already built, skipping
[INFO]: Building scipy for armeabi-v7a
[INFO]: scipy apparently isn't already in site-packages
[INFO]: Building compiled components in scipy
[INFO]: -> directory context /home/kivy/.local/share/python-for-android/build/other_builds/scipy/armeabi-v7a__ndk_target_21/scipy
[INFO]: -> running python3 setup.py build_ext -v -j 1
working: Error: 'numpy' must be installed before running the build. Exception in thread background thread for pid 1206223:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/kivy/.local/lib/python3.8/site-packages/sh.py", line 1683, in wrap
fn(*rgs, **kwargs)
File "/home/kivy/.local/lib/python3.8/site-packages/sh.py", line 2662, in background_thread
handle_exit_code(exit_code)
File "/home/kivy/.local/lib/python3.8/site-packages/sh.py", line 2349, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/kivy/.local/lib/python3.8/site-packages/sh.py", line 905, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:

RAN: /home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py build_ext -v -j 1

STDOUT:
Error: 'numpy' must be installed before running the build.

STDERR:

Traceback (most recent call last):
File "/home/kivy/.local/bin/p4a", line 8, in
sys.exit(main())
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/entrypoints.py", line 18, in main
ToolchainCL()
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/toolchain.py", line 725, in init
getattr(self, command)(args)
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/toolchain.py", line 153, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/toolchain.py", line 212, in build_dist_from_args
build_recipes(build_order, python_modules, ctx,
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/build.py", line 580, in build_recipes
recipe.build_arch(arch)
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/recipe.py", line 1011, in build_arch
self.build_compiled_components(arch)
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/recipes/scipy/init.py", line 16, in build_compiled_components
super().build_compiled_components(arch)
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/recipe.py", line 1022, in build_compiled_components
shprint(hostpython, 'setup.py', self.build_cmd, '-v',
File "/home/kivy/.local/lib/python3.8/site-packages/pythonforandroid/logger.py", line 167, in shprint
for line in output:
File "/home/kivy/.local/lib/python3.8/site-packages/sh.py", line 953, in next
self.wait()
File "/home/kivy/.local/lib/python3.8/site-packages/sh.py", line 879, in wait
self.handle_command_exit_code(exit_code)
File "/home/kivy/.local/lib/python3.8/site-packages/sh.py", line 905, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:

RAN: /home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py build_ext -v -j 1

STDOUT:
Error: 'numpy' must be installed before running the build.

@killangell killangell changed the title Scipy is not installed due to depency on numpy Scipy is not installed due to "Error: 'numpy' must be installed before running the build." Oct 17, 2021
@mzakharo
Copy link
Contributor

this patch: 7f4652a adds scipy support, and also updates numpy recipe with install_in_hostpython = True . I would just try and build numpy recipe first, and make sure your p4a built hostpython can import numpy .

@killangell
Copy link
Author

this patch: 7f4652a adds scipy support, and also updates numpy recipe with install_in_hostpython = True . I would just try and build numpy recipe first, and make sure your p4a built hostpython can import numpy .

Thanks for the reply.
Yes, I saw that patch and I updated p4a to the latest version "2021.09.05".
My build ENV works correctly before I add support for scipy.

Would you please let me know how should I check if this works or not in my ENV.
make sure your p4a built hostpython can import numpy

@killangell
Copy link
Author

I found if I remove scipy from the requirements of p4a command and the command as below, the numpy can be successfully built and installed into site-packages.
p4a ... --requirements=...numpy

I can see the directory:
/home/kivy/.local/share/python-for-android/dists/unnamed_dist_1__armeabi-v7a/_python_bundle/_python_bundle/site-packages/numpy/

But once I add scipy in the end, the numpy is missing from the site-packages
p4a ... --requirements=...numpy,scipy

So it looks like an issue of scipy but I'm not sure.

@mzakharo
Copy link
Contributor

try checking out p4a at 7f4652a and see if it works there.

@killangell
Copy link
Author

try checking out p4a at 7f4652a and see if it works there.

Thanks for the help, with this patch, seems things got different than before.
I got new error : arm-linux-androideabi/bin/ld: error: cannot find -lunwind

While I searched in my ENV, it's should be there:
/home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libunwind.a
/home/kivy/Android/android-ndk-r19b/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a

Any suggestion for how to move forward, appreciate for the help.

error below
compile options: '-I/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages/numpy/core/include -I/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages/numpy/core/include -I/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/Include -I/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build -c'
clang -L/home/kivy/.local/share/python-for-android/build/libs_collections/unnamed_dist_1/armeabi-v7a -L/home/kivy/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/android-build -lpython3.8 -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions --sysroot=/home/kivy/Android/android-ndk-r19b/platforms/android-21/arch-arm -L/home/kivy/Android/android-ndk-r19b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/lib64 -L/home/kivy/.local/share/python-for-android/build/python-installs/unnamed_dist_1/numpy/core/lib -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -I/home/kivy/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Include -DANDROID -D__ANDROID_API__=21 -I/home/kivy/Android/android-ndk-r19b/sysroot/usr/include/arm-linux-androideabi -I/home/kivy/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python3.8 --sysroot=/home/kivy/Android/android-ndk-r19b/platforms/android-21/arch-arm -I/home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1 -I/home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include build/temp.linux-x86_64-3.8/scipy/cluster/_vq.o -Lbuild/temp.linux-x86_64-3.8 -o build/lib.linux-x86_64-3.8/scipy/cluster/_vq.cpython-38-x86_64-linux-gnu.so -Wl,--version-script=build/temp.linux-x86_64-3.8/link-version-scipy.cluster._vq.map
/home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lunwind
/home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lunwind

@mzakharo
Copy link
Contributor

when building for 32bit, you need to check out p4a to fe5c909

@killangell
Copy link
Author

when building for 32bit, you need to check out p4a to fe5c909

Thanks for the help, after I checkout this patch, I successfully built app twice but the app is not running on android for reason that some library in psutil is not for arm.
So I added recipy for psutil and executed 'p4a clean_all' and then build app again, however I cannot build successfully again.

Seems it complains about 'threads.h' cannot be find on my ENV while building scipy, I searched on my ENV, there's indeed no such file. Does it mean there's some file missing in my android SDK? Sorry to bother you time and time again.

I took threads.h and unwind.h for example to share what the head file path is. android_source directory is a 3rd party thing which is not deployed done for my ENV. Which path should I place the threads.h head file then p4a can find it automatically?

kivy@kivy-virtual-machine:/$ sudo find / -name unwind.h
/home/kivy/Android/SDK/build-tools/29.0.0/renderscript/clang-include/unwind.h
/home/kivy/Android/android-ndk-r19b/toolchains/renderscript/prebuilt/linux-x86_64/clang-include/unwind.h
/home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/8.0.2/include/unwind.h
/home/kivy/work/tool/libunwind/include/unwind.h
/home/kivy/work/android_source/out/dist/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/darwin-x86_64/mipsel-linux-android-4.9/lib/gcc/mipsel-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/darwin-x86_64/x86_64-4.9/lib/gcc/x86_64-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/darwin-x86_64/aarch64-linux-android-4.9/lib/gcc/aarch64-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/darwin-x86_64/mips64el-linux-android-4.9/lib/gcc/mips64el-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/darwin-x86_64/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/darwin-x86_64/x86-4.9/lib/gcc/i686-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows-x86_64/mipsel-linux-android-4.9/lib/gcc/mipsel-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows-x86_64/x86_64-4.9/lib/gcc/x86_64-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows-x86_64/aarch64-linux-android-4.9/lib/gcc/aarch64-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows-x86_64/mips64el-linux-android-4.9/lib/gcc/mips64el-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows-x86_64/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows-x86_64/x86-4.9/lib/gcc/i686-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows/mipsel-linux-android-4.9/lib/gcc/mipsel-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows/x86_64-4.9/lib/gcc/x86_64-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows/aarch64-linux-android-4.9/lib/gcc/aarch64-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows/mips64el-linux-android-4.9/lib/gcc/mips64el-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/windows/x86-4.9/lib/gcc/i686-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/linux-x86_64/mipsel-linux-android-4.9/lib/gcc/mipsel-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/linux-x86_64/x86_64-4.9/lib/gcc/x86_64-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/linux-x86_64/aarch64-linux-android-4.9/lib/gcc/aarch64-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/linux-x86_64/mips64el-linux-android-4.9/lib/gcc/mips64el-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/linux-x86_64/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/ndk/current/toolchains/linux-x86_64/x86-4.9/lib/gcc/i686-linux-android/4.9.x/include/unwind.h
/home/kivy/work/android_source/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1/lib/gcc/i686-apple-darwin11/4.2.1/include/unwind.h
/home/kivy/work/android_source/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1/lib/gcc/i686-apple-darwin10/4.2.1/include/unwind.h
/home/kivy/work/android_source/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/lib/gcc/x86_64-w64-mingw32/4.8.3/include/unwind.h
/home/kivy/work/android_source/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/lib/gcc/x86_64-linux/4.8/include/unwind.h
/home/kivy/work/android_source/toolchain/binutils/binutils-2.27/include/mach-o/unwind.h
/tmp/ndk-kivy/aarch64-linux-android-4.9/lib/gcc/aarch64-linux-android/4.9.x/include/unwind.h
/tmp/ndk-kivy/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x/include/unwind.h
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/src/linux-hwe-5.11-headers-5.11.0-27/arch/parisc/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-27/arch/ia64/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-27/arch/arc/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-27/arch/um/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-27/arch/x86/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-27/arch/microblaze/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-27/arch/s390/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-27/arch/arm/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/arch/parisc/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/arch/ia64/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/arch/arc/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/arch/um/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/arch/x86/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/arch/microblaze/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/arch/s390/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/arch/arm/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/arch/parisc/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/arch/ia64/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/arch/arc/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/arch/um/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/arch/x86/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/arch/microblaze/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/arch/s390/include/asm/unwind.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/arch/arm/include/asm/unwind.h
/usr/lib/gcc/x86_64-linux-gnu/9/include/unwind.h
kivy@kivy-virtual-machine:/$
kivy@kivy-virtual-machine:/$
kivy@kivy-virtual-machine:/$ sudo find / -name threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-18/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-18/arch-x86/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-15/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-15/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-15/arch-x86/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-13/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-13/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-13/arch-x86/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-16/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-16/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-16/arch-x86/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-17/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-17/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-17/arch-x86/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-19/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-19/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-19/arch-x86/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-14/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-14/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-14/arch-x86/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-9/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-9/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-9/arch-x86/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-12/arch-arm/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-12/arch-mips/usr/include/linux/threads.h
/home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-12/arch-x86/usr/include/linux/threads.h
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/src/linux-hwe-5.11-headers-5.11.0-27/include/linux/threads.h
/usr/src/linux-hwe-5.11-headers-5.11.0-38/include/linux/threads.h
/usr/src/linux-hwe-5.11-headers-5.11.0-37/include/linux/threads.h
/usr/include/threads.h

log as below.

/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages/numpy/core/include/numpy/npy_common.h:210:23: note:
expanded from macro 'npy_ftell'
#define npy_ftell ftello
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:88:10: fatal error:
'threads.h' file not found
#include <threads.h>
^~~~~~~~~~~
4 warnings and 1 error generated.
error: Command "/usr/bin/ccache /home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -I/home/kivy/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Include -DANDROID -D__ANDROID_API__=21 -I/home/kivy/Android/android-ndk-r19b/sysroot/usr/include/arm-linux-androideabi -I/home/kivy/.local/share/python-for-android/build/python-installs/unnamed_dist_1/include/python3.8 --sysroot=/home/kivy/Android/android-ndk-r19b/platforms/android-21/arch-arm -I/home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1 -I/home/kivy/Android/android-ndk-r19b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -fPIC -DNO_ATLAS_INFO=1 -I/home/kivy/.local/share/python-for-android/build/other_builds/lapack/armeabi-v7a__ndk_target_21/lapack/build/install/lib -Iscipy/integrate/ -Ibuild/src.linux-x86_64-3.8/build/src.linux-x86_64-3.8/scipy/integrate -I/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.8/numpy/distutils/include -I/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/Include -I/home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build -c build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c -o build/temp.linux-x86_64-3.8/build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.o -MMD -MF build/temp.linux-x86_64-3.8/build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.o.d" failed with exit status 1

########### EXT COMPILER OPTIMIZATION ###########
Platform :
Architecture: x64
Compiler : unix-like

CPU baseline :
Requested : 'min'
Enabled : none
Flags : none
Extra checks: none

CPU dispatch :
Requested : 'max -xop -fma4'
Enabled : none
Generated : none
CCompilerOpt.cache_flush[809] : write cache to path -> /home/kivy/.local/share/python-for-android/build/other_builds/scipy/armeabi-v7a__ndk_target_21/scipy/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_ext.py

########### CLIB COMPILER OPTIMIZATION ###########
Platform :
Architecture: x64
Compiler : unix-like

CPU baseline :
Requested : 'min'
Enabled : none
Flags : none
Extra checks: none

CPU dispatch :
Requested : 'max -xop -fma4'
Enabled : none
Generated : none
CCompilerOpt.cache_flush[809] : write cache to path -> /home/kivy/.local/share/python-for-android/build/other_builds/scipy/armeabi-v7a__ndk_target_21/scipy/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_clib.py

@killangell
Copy link
Author

I tried to copy threads.h as follows:
kivy@kivy-virtual-machine:/$ cp /home/kivy/work/android_source/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/include/linux/threads.h /home/kivy/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/Include/

Another issue appeared:

^

build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:618:12: error: use of undeclared identifier '_active_cb_jac_in_dvode__user__routines'; did you mean 'get_active_cb_jac_in_dvode__user__routines'?
return _active_cb_jac_in_dvode__user__routines;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
get_active_cb_jac_in_dvode__user__routines
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:617:43: note: 'get_active_cb_jac_in_dvode__user__routines' declared here
static cb_jac_in_dvode__user__routines_t *get_active_cb_jac_in_dvode__user__routines(void) {
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:652:9: warning: unused variable 'ipar' [-Wunused-variable]
int ipar=(*ipar_cb_capi);
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:648:9: warning: unused variable 'ml' [-Wunused-variable]
int ml=(*ml_cb_capi);
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:649:9: warning: unused variable 'mu' [-Wunused-variable]
int mu=(*mu_cb_capi);
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:651:12: warning: unused variable 'rpar' [-Wunused-variable]
double rpar=(*rpar_cb_capi);
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:803:8: error: unknown type name 'thread_local'
static F2PY_THREAD_LOCAL_DECL cb_f_in_zvode__user__routines_t *_active_cb_f_in_zvode__user__routines = NULL;
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:89:32: note: expanded from macro 'F2PY_THREAD_LOCAL_DECL'
#define F2PY_THREAD_LOCAL_DECL thread_local
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:803:62: error: expected ';' after top level declarator
static F2PY_THREAD_LOCAL_DECL cb_f_in_zvode__user__routines_t *_active_cb_f_in_zvode__user__routines = NULL;
^
;
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:806:45: error: use of undeclared identifier '_active_cb_f_in_zvode__user__routines'
cb_f_in_zvode__user__routines_t *prev = _active_cb_f_in_zvode__user__routines;
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:807:5: error: use of undeclared identifier '_active_cb_f_in_zvode__user__routines'
_active_cb_f_in_zvode__user__routines = ptr;
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:812:12: error: use of undeclared identifier '_active_cb_f_in_zvode__user__routines'; did you mean 'get_active_cb_f_in_zvode__user__routines'?
return _active_cb_f_in_zvode__user__routines;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
get_active_cb_f_in_zvode__user__routines
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:811:41: note: 'get_active_cb_f_in_zvode__user__routines' declared here
static cb_f_in_zvode__user__routines_t *get_active_cb_f_in_zvode__user__routines(void) {
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:843:9: warning: unused variable 'ipar' [-Wunused-variable]
int ipar=(*ipar_cb_capi);
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:842:12: warning: unused variable 'rpar' [-Wunused-variable]
double rpar=(*rpar_cb_capi);
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:995:8: error: unknown type name 'thread_local'
static F2PY_THREAD_LOCAL_DECL cb_jac_in_zvode__user__routines_t *_active_cb_jac_in_zvode__user__routines = NULL;
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:89:32: note: expanded from macro 'F2PY_THREAD_LOCAL_DECL'
#define F2PY_THREAD_LOCAL_DECL thread_local
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:995:64: error: expected ';' after top level declarator
static F2PY_THREAD_LOCAL_DECL cb_jac_in_zvode__user__routines_t *_active_cb_jac_in_zvode__user__routines = NULL;
^
;
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:998:47: error: use of undeclared identifier '_active_cb_jac_in_zvode__user__routines'
cb_jac_in_zvode__user__routines_t *prev = _active_cb_jac_in_zvode__user__routines;
^
build/src.linux-x86_64-3.8/scipy/integrate/vodemodule.c:999:5: error: use of undeclared identifier '_active_cb_jac_in_zvode__user__routines'
_active_cb_jac_in_zvode__user__routines = ptr;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
14 warnings and 20 errors generated.

@killangell
Copy link
Author

Besides my last comment, I missed another error for building lapack, it cannot find cblas.h.

Path on my ENV
kivy@kivy-virtual-machine:/$ sudo find / -name cblas.h
[sudo] password for kivy:
/home/kivy/.local/share/python-for-android/build/other_builds/lapack/armeabi-v7a__ndk_target_21/lapack/build/install/include/cblas.h
/home/kivy/.local/share/python-for-android/build/other_builds/lapack/armeabi-v7a__ndk_target_21/lapack/build/include/cblas.h
/home/kivy/.local/share/python-for-android/build/other_builds/lapack/armeabi-v7a__ndk_target_21/lapack/CBLAS/include/cblas.h
find: ‘/run/user/1000/gvfs’: Per

Error
creating /tmp/tmps2il8dd4/tmp
creating /tmp/tmps2il8dd4/tmp/tmps2il8dd4
compile options: '-I/home/kivy/.local/share/python-for-android/build/other_builds/lapack/armeabi-v7a__ndk_target_21/lapack/build/install/lib -I -c'
ccache: /tmp/tmps2il8dd4/source.c
/tmp/tmps2il8dd4/source.c:1:10: fatal error: 'cblas.h' file not found
#include <cblas.h>
^~~~~~~~~
1 error generated.

@mzakharo
Copy link
Contributor

As per comment here: make sure you have latest cmake. Patches were tested using NDK r19c, and target API 28.

@killangell
Copy link
Author

As per comment here: make sure you have latest cmake. Patches were tested using NDK r19c, and target API 28.

I'm using r19b, not sure if that the difference is causing the problem on my side.
I didn't solve it at last, I've tried to avoid using scipy in the code, will pick it up again in future if it's a must.
Anyway, thanks for help on this, it can be closed.

@buybuyxyz
Copy link

buybuyxyz commented Oct 25, 2021

I've tried it too and I'm getting the same error.

Case1) p4a master, ndk version 19c + gfortran, target api 27, cmake version 3.16.3, OS Ubuntu 20.04, target CPU=armeabi-v7a
Case2) p4a master, ndk version 19c + gfortran, target api 30, cmake version 3.21.3, OS Ubuntu 20.04, target CPU=armeabi-v7a

Task :stripDebugDebugSymbols FAILED
Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':stripDebugDebugSymbols'.

No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi

Case3) p4a master, ndk version 19c + gfortran, target api 27, cmake version 3.16.3, OS Ubuntu 20.04, target CPU=arm64-v8a

Task :stripDebugDebugSymbols FAILED
Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':stripDebugDebugSymbols'.

No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi

Since the compilation of Scipy has been successful, I think that if you put the compiled Scipy at the top of the project and modify the include relation of buildozer.spec, you can create apk or aab of one CPU. I haven't tried it yet.

@mzakharo
Copy link
Contributor

mzakharo commented Jun 6, 2022

Please try building lapack/scipy in the latest develop branch, #2615 is introduced to solve build issues with latest changes in p4a.

@misl6
Copy link
Member

misl6 commented Jul 10, 2022

Fixed via #2615. Feel free to re-open if the issue still persists.

@misl6 misl6 closed this as completed Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants