Vlákno názorů k článku Nuitka: pokročilý AOT překladač jazyka Python od Noris - Hmm, ať dělám, co dělám, numpy nedokážu zkompilovat. ~/prog-p/bench2...

  • Článek je starý, nové názory již nelze přidávat.
  • 23. 5. 2024 15:01

    Noris

    Hmm, ať dělám, co dělám, numpy nedokážu zkompilovat.

    ~/prog-p/bench2 $ make
    # Kompilace skriptu pomocí Nuitka
    python -m nuitka --standalone --onefile --enable-plugin=numpy bench.py
    Nuitka-Options: Used command line options: --standalone --onefile --enable-plugin=numpy bench.py
    Nuitka-Plugins:WARNING: numpy: This plugin has been deprecated, do not enable it anymore.
    Nuitka: Starting Python compilation with Nuitka '2.2.3' on Python '3.11' commercial grade 'not installed'.
    Nuitka-Plugins:anti-bloat: Not including '_bisect' automatically in order to avoid bloat, but this may cause: may slow down by using fallback implementation.
    Nuitka-Plugins:anti-bloat: Not including '_json' automatically in order to avoid bloat, but this may cause: may slow down by using fallback implementation.
    Nuitka: Completed Python level compilation and optimization.
    Nuitka: Generating source code for C backend compiler.
    Nuitka: Running data composer tool for optimal constant value handling.
    Nuitka: Running C compilation via Scons.
    Nuitka-Scons: Backend C compiler: clang (clang 18.1.6).
    Nuitka-Scons: Inherited CFLAGS='--target=aarch64-linux-android24' variable.
    Nuitka-Scons: Scons: Inherited LDFLAGS='--target=aarch64-linux-android24' variable.
    Nuitka-Scons: Backend linking program with 117 files (no progress information available for this stage).
    Nuitka-Scons: Compiled 116 C files using ccache.
    Nuitka-Scons: Cached C files (using ccache) with result 'cache hit': 116
    Nuitka-Postprocessing: Creating single file from dist folder, this may take a while.
    Nuitka-Onefile: Running bootstrap binary compilation via Scons.
    Nuitka-Scons: Onefile C compiler: clang (clang 18.1.6).
    Nuitka-Scons: Inherited CFLAGS='--target=aarch64-linux-android24' variable.
    Nuitka-Scons: Scons: Inherited LDFLAGS='--target=aarch64-linux-android24' variable.
    Nuitka-Scons: Onefile linking program with 1 files (no progress information available for this stage).
    Nuitka-Scons: Compiled 1 C files using ccache.
    Nuitka-Scons: Cached C files (using ccache) with result 'cache hit': 1
    Nuitka-Onefile: Using compression for onefile payload.
    Nuitka-Onefile: Onefile payload compression ratio (26.35%) size 41350398 to 10896160.
    Nuitka-Onefile: Keeping onefile build directory 'bench.onefile-build'.
    Nuitka: Keeping dist folder 'bench.dist' for inspection, no need to use it.
    Nuitka: Keeping build directory 'bench.build'.
    Nuitka: Successfully created 'bench.bin'.
    # Spuštění binárního souboru
    ./bench.bin
    Traceback (most recent call last):
      File "/data/data/com.termux/files/usr/tmp/onefile_30658_1716468864_501654/numpy/__init__.py", line 130, in <module numpy>
      File "/data/data/com.termux/files/usr/tmp/onefile_30658_1716468864_501654/numpy/__config__.py", line 4, in <module numpy.__config__>
      File "/data/data/com.termux/files/usr/tmp/onefile_30658_1716468864_501654/numpy/core/__init__.py", line 24, in <module numpy.core>
      File "/data/data/com.termux/files/usr/tmp/onefile_30658_1716468864_501654/numpy/core/multiarray.py", line 10, in <module numpy.core.multiarray>
      File "/data/data/com.termux/files/usr/tmp/onefile_30658_1716468864_501654/numpy/core/overrides.py", line 8, in <module numpy.core.overrides>
    ImportError: dlopen failed: library "libopenblas.so" not found: needed by /data/data/com.termux/files/usr/tmp/onefile_30658_1716468864_501654/numpy/core/_multiarray_umath.so in namespace (default)
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/data/data/com.termux/files/usr/tmp/onefile_30658_1716468864_501654/bench.py", line 2, in <module>
        import numpy as np
    
      File "/data/data/com.termux/files/usr/tmp/onefile_30658_1716468864_501654/numpy/__init__.py", line 135, in <module numpy>
    ImportError: Error importing numpy: you should not try to import numpy from
            its source directory; please exit the numpy source tree, and relaunch
            your python interpreter from there.
    make: *** [Makefile:13: run] Error 1
  • 23. 5. 2024 18:56

    atarist

    me to jde:

    $ python -m nuitka --standalone --onefile harmonic_fp16.py
    Nuitka-Options: Used command line options: --standalone --onefile harmonic_fp16.py
    Nuitka: Starting Python compilation with Nuitka '2.2.3' on Python '3.11' commercial grade 'not installed'.
    Nuitka-Plugins:anti-bloat: Not including '_bisect' automatically in order to avoid bloat, but this may cause: may slow down by using
    Nuitka-Plugins:anti-bloat: fallback implementation.
    Nuitka-Plugins:anti-bloat: Not including '_json' automatically in order to avoid bloat, but this may cause: may slow down by using
    Nuitka-Plugins:anti-bloat: fallback implementation.
    Nuitka: Completed Python level compilation and optimization.
    Nuitka: Generating source code for C backend compiler.
    Nuitka: Running data composer tool for optimal constant value handling.
    Nuitka: Running C compilation via Scons.
    Nuitka-Scons: Backend C compiler: gcc (gcc 13).
    Nuitka-Scons: Backend linking program with 118 files (no progress information available for this stage).
    Nuitka-Scons:WARNING: You are not using ccache, re-compilation of identical code will be slower than necessary. Use your OS package
    Nuitka-Scons:WARNING: manager to install it.
    Nuitka-Postprocessing: Creating single file from dist folder, this may take a while.
    Nuitka-Onefile: Running bootstrap binary compilation via Scons.
    Nuitka-Scons: Onefile C compiler: gcc (gcc 13).
    Nuitka-Scons: Onefile linking program with 1 files (no progress information available for this stage).
    Nuitka-Scons:WARNING: You are not using ccache, re-compilation of identical code will be slower than necessary. Use your OS package
    Nuitka-Scons:WARNING: manager to install it.
    Nuitka-Onefile: Using compression for onefile payload.
    Nuitka-Onefile: Onefile payload compression ratio (20.80%) size 88835015 to 18478682.
    Nuitka-Onefile: Keeping onefile build directory 'harmonic_fp16.onefile-build'.
    Nuitka: Keeping dist folder 'harmonic_fp16.dist' for inspection, no need to use it.
    Nuitka: Keeping build directory 'harmonic_fp16.build'.
    Nuitka: Successfully created 'harmonic_fp16.bin

    vysledek ma nejakych 18MB, to je podezrele malo :)

  • 25. 5. 2024 22:02

    Noris

    Ne, normálně z pythonu to spustit lze, jen po přeložení nuitkou to spustit nelze. Knihovny jsou, ale nuitka to překládá špatně.

  • 27. 5. 2024 18:08

    Noris

    Viz článek a podpora tk-inter, ale nuitka už tento příkax asi nepodporuje a nepřišel jsem na to, jak to zprovoznit jinak. Python bez numpy je pro mne poloviční, takže nuitka není pro mě, i když onefile binárka by se mi jinak líbila.

  • 28. 5. 2024 18:28

    Bez přezůvek

    V tom chybovém výpisu ti to píše, že ten plugin nemáš zapínat. Zkoušel jsi to bez toho? Když u sebe dám --plugin-list, tak mi to numpy ani nevypisuje a když to prostě kompiluju bez zapínání pluginu, tak se to v pohodě zkompiluje. Je při tom vidět, že to "něco dělá" i s numpy a program pak funguje.

  • 1. 6. 2024 11:28

    Noris

    Jasně, dal jsem překlad nejprve bez toho. Na nějakém fóru jsem se dočetl, že tento plugin už není podporován. Imho je to s numpy nepřeložitelné a python bez numpy je poloviční, s tím můj zájem o nuitku skončil.