its-pointless / gcc_termux

Gcc for termux with fortran scipy etc... Use apt for newest updates instructions in README.txt
463 stars 75 forks source link

Python 3.8.0 import numpy fails #114

Closed eusoubrasileiro closed 3 years ago

eusoubrasileiro commented 3 years ago

I followed the instructions in here for numpy and scipy installation.

My Python, default for pkg. Python 3.8.0 (default, Dec 5 2019, 10:53:43) [Clang 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf6 on linux

I am on Android 5.1.1 and uname- m aarch64

Unfortunatelly I get after import numpy ModuleNotFoundError: No module named 'numpy'

Weirdly I found that it installed in site-packages numpy for python 3.7.5. But there is no python 3.7.5 installed.

if I install using pip install numpy I get the following when I try import numpy

WARNING: linker: /data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/_multiarray_umath.cpython-38.so: unused DT entry: type 0x6ffffef5 arg 0x1668
WARNING: linker: /data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/_multiarray_tests.cpython-38.so: unused DT entry: type 0x6ffffef5 arg 0xd00
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/__init__.py", line 145, in <module>
    from . import core
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/__init__.py", line 98, in <module>
    from . import _add_newdocs
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/_add_newdocs.py", line 4452, in <module>
    add_newdoc('numpy.core._multiarray_tests', 'format_float_OSprintf_g',
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/function_base.py", line 521, in add_newdoc
    new = getattr(__import__(place, globals(), {}, [obj]), obj)
ImportError: dlopen failed: cannot locate symbol "tanh" referenced by "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/_multiarray_tests.cpython-38.so"...

If I install the python 3.7.5 from termux-pod using dpkg -i I get the error bellow and I cant even install the static version.

  WARNING: linker: /data/data/com.termux/files/usr/bin/python: unused DT entry: type 0x6ffffef5 arg 0x4c0
  WARNING: linker: /data/data/com.termux/files/usr/bin/python: unused DT entry: type 0x1d arg 0xaf
  WARNING: linker: /data/data/com.termux/files/usr/bin/python: unused DT entry: type 0x6ffffffe arg 0x56c
  WARNING: linker: /data/data/com.termux/files/usr/bin/python: unused DT entry: type 0x6fffffff arg 0x1
  WARNING: linker: libpython3.7m.so.1.0: unused DT entry: type 0x6ffffef5 arg 0x16b88
  WARNING: linker: libpython3.7m.so.1.0: unused DT entry: type 0x1d arg 0x9ca3
  WARNING: linker: libpython3.7m.so.1.0: unused DT entry: type 0x6ffffffe arg 0x1f450
  WARNING: linker: libpython3.7m.so.1.0: unused DT entry: type 0x6fffffff arg 0x3
  CANNOT LINK EXECUTABLE DEPENDENCIES: cannot locate symbol "__register_atfork" referenced by "libpython3.7m.so.1.0"...

I manage to install from source using the 1.18 version. Unfortunatelly, it also went bad.

>>> import numpy
WARNING: linker: /data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/_multiarray_umath.cpython-38.so: unused DT entry: type 0x6ffffef5 arg 0x1668
WARNING: linker: /data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/_multiarray_tests.cpython-38.so: unused DT entry: type 0x6ffffef5 arg 0xd00
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/__init__.py", line 145, in <module>
    from . import core
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/__init__.py", line 98, in <module>
    from . import _add_newdocs
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/_add_newdocs.py", line 4452, in <module>
    add_newdoc('numpy.core._multiarray_tests', 'format_float_OSprintf_g',
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/function_base.py", line 521, in add_newdoc
    new = getattr(__import__(place, globals(), {}, [obj]), obj)
ImportError: dlopen failed: cannot locate symbol "tanh" referenced by "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/_multiarray_tests.cpython-38.so"...

Is it possible for me to build a wokring numpy for aarch64 for python 3.8.0 or early versions? Could give me some advice or guidance?

Thank you very much

its-pointless commented 3 years ago

the current version uses https://its-pointless.github.io/files/24 you need https://its-pointless.github.io/files/21 this should be in the file $PREFIX/etc/apt/sources.list.d/pointless.list

eusoubrasileiro commented 3 years ago

Thank you very much for the answer it would certainly work.

Unfortunately, since I am turning my old phone in a NVR system I installed a custom room (LineageOS 15.1 - Android 8.1.0) and pip install numpy worked in there.

Thank you again!

liltaylor commented 2 years ago

the current version uses https://its-pointless.github.io/files/24 you need https://its-pointless.github.io/files/21 this should be in the file $PREFIX/etc/apt/sources.list.d/pointless.list

High, sorry to bother you, I currently think I have the opposite issue: I have 21 (for some reason!) and I should have 24, because I am on Android 11 and my python is 3.10. Can I simply change "21" to "24" in the pointless.list file, update, and expect everything to work fine?

Thanks in advance