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

Importing the multiarray numpy extension module failed. #1778

Open
z-huabao opened this issue Apr 2, 2019 · 4 comments
Open

Importing the multiarray numpy extension module failed. #1778

z-huabao opened this issue Apr 2, 2019 · 4 comments

Comments

@z-huabao
Copy link

z-huabao commented Apr 2, 2019

Versions

  • Python: 3.5.2 and 3.6.7
  • OS: Ubuntu16 and Ubuntu18
  • Kivy: 1.10.1
  • Cython: 0.28 and 0.29

Description

I use numpy in my code, and use buldozer to build app, building is ok, but app broke when run my app in Android.
And this error disappear if not import numy.
I have try numpy 1.15, 1.16, they are same, but 1.14 build fail!

It seems like Issue 1678, but I have not use opencv.

buildozer.spec

Command:

buildozer android debug

Spec file:

[app]

# (str) Title of your application
title = OilDetector

# (str) Package name
package.name = OilDetector

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test.OilDetector

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas

version = 0.1

requirements = python3,kivy,numpy

orientation = landscape

osx.python_version = 2

# Kivy version to use
osx.kivy_version = 1.9.1

fullscreen = 1
android.api = 28

android.ndk = 17c

android.arch = arm64-v8a

ios.kivy_ios_url = https://github.com/kivy/kivy-ios
ios.kivy_ios_branch = master

ios.ios_deploy_url = https://github.com/phonegap/ios-deploy
ios.ios_deploy_branch = 1.7.0


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2

# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1

Logs

04-02 17:40:18.841  3185  3221 I python  :  Traceback (most recent call last):
04-02 17:40:18.841  3185  3221 I python  :    File "/home/zhb/my_projects/StateGrid-project/kivy/.buildozer/android/platform/build/build/python-installs/OilDetector/numpy/core/__init__.py", line 16, in <module>
04-02 17:40:18.841  3185  3221 I python  :  ImportError: dlopen failed: cannot locate symbol "__fixunstfsi" referenced by "/data/data/org.test.oildetector.oildetector/files/app/_python_bundle/site-packages/numpy/core/multiarray.so"...
04-02 17:40:18.842  3185  3221 I python  :
04-02 17:40:18.842  3185  3221 I python  :  During handling of the above exception, another exception occurred:
04-02 17:40:18.842  3185  3221 I python  :
04-02 17:40:18.842  3185  3221 I python  :  Traceback (most recent call last):
04-02 17:40:18.842  3185  3221 I python  :    File "/home/zhb/.buildozer/.buildozer/android/app/main.py", line 8, in <module>
04-02 17:40:18.843  3185  3221 I python  :    File "/home/zhb/.buildozer/.buildozer/android/app/shoot_screen.py", line 5, in <module>
04-02 17:40:18.843  3185  3221 I python  :    File "/home/zhb/my_projects/StateGrid-project/kivy/.buildozer/android/platform/build/build/python-installs/OilDetector/numpy/__init__.py", line 142, in <module>
04-02 17:40:18.843  3185  3221 I python  :    File "/home/zhb/my_projects/StateGrid-project/kivy/.buildozer/android/platform/build/build/python-installs/OilDetector/numpy/add_newdocs.py", line 13, in <module>
04-02 17:40:18.844  3185  3221 I python  :    File "/home/zhb/my_projects/StateGrid-project/kivy/.buildozer/android/platform/build/build/python-installs/OilDetector/numpy/lib/__init__.py", line 8, in <module>
04-02 17:40:18.844  3185  3221 I python  :    File "/home/zhb/my_projects/StateGrid-project/kivy/.buildozer/android/platform/build/build/python-installs/OilDetector/numpy/lib/type_check.py", line 11, in <module>
04-02 17:40:18.845  3185  3221 I python  :    File "/home/zhb/my_projects/StateGrid-project/kivy/.buildozer/android/platform/build/build/python-installs/OilDetector/numpy/core/__init__.py", line 26, in <module>
04-02 17:40:18.845  3185  3221 I python  :  ImportError:
04-02 17:40:18.845  3185  3221 I python  :  Importing the multiarray numpy extension module failed.  Most
04-02 17:40:18.846  3185  3221 I python  :  likely you are trying to import a failed build of numpy.
04-02 17:40:18.846  3185  3221 I python  :  If you're working with a numpy git repo, try `git clean -xdf` (removes all
04-02 17:40:18.846  3185  3221 I python  :  files not under version control).  Otherwise reinstall numpy.
04-02 17:40:18.846  3185  3221 I python  :
04-02 17:40:18.846  3185  3221 I python  :  Original error was: dlopen failed: cannot locate symbol "__fixunstfsi" referenced by "/data/data/org.test.oildetector.oildetector/files/app/_python_bundle/site-packages/numpy/core/multiarray.so"...
04-02 17:40:18.846  3185  3221 I python  :
04-02 17:40:18.846  3185  3221 I python  : Python for android ended.

@inclement
Copy link
Member

Thanks for the report, not sure what's wrong here - the error is clear enough, but I don't know why that symbol would be missing and didn't find anything in a quick google. I'll try to reproduce.

@chengyingyuan
Copy link

I use python-for-android and get the same issue:

dlopen failed: cannot locate symbol "__fixunstfsi" referenced by .../numpy/core/multiarray.so"

python-for-android is installed from git repository using pip. Arch of armeabi-v7a works well, but arch of arm64-v8a gets runtime error as mentioned above.

My building scripts:

export ANDROIDAPI="26" # Target API version of your application
export NDKAPI="26" # Minimum supported API version of your application
#export ANDROIDNDKVER="r17c" # Version of the NDK you installed

p4a apk --arch arm64-v8a --private $HOME/build/wvhellopy --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy,numpy,opencv,setuptools,pytz,pip

I've tried the following ways:
1 Googled without results
2 Run "strings multiarray.so" and get symbol __fixunstfsi, no other .so files having this symbol
3 Grepping source code of numpy, no symbol __fixunstfsi found
4 Set LD_LIBRARY_PATH to every .so paths(including /system/lib64)
5 Changing init.py which is in recipes/numpy directory, adding '-lm -lcompiler_rt' without success

Maybe it is a stub function added by compiler, but I cannot figure out how.

@brvier
Copy link
Contributor

brvier commented Jun 13, 2019

Look like related to soft float

https://gcc.gnu.org/onlinedocs/gccint/Soft-float-library-routines.html

@tcdude
Copy link
Contributor

tcdude commented Mar 15, 2020

I ran into the same error. It only happens on for me arm64-v8a which is a problem, since to release an app you have to provide both armeabi-v7a and arm64-v8a APKs to publish in google play...

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

No branches or pull requests

5 participants