Nuitka: Standalone fails to handle apsw, needs to support `package_name/__init__.so` for output
In standalone or onefile mode nuitka allows apsw to be imported, but the module contents are empty.
This was originally reported at https://github.com/rogerbinns/apsw/issues/399
$ python3 -m pip install --user apsw
$ python3 -m pip install --user -U "https://github.com/Nuitka/Nuitka/archive/develop.zip"
$ cat foo.py
import apsw
def main():
print(dir(apsw)[:15))
print(apsw.sqlitelibversion())
if __name__ == '__main__':
main()
$ python3 foo.py
['AbortError', 'AuthError', 'Backup', 'BindingsError', 'Blob', 'BusyError', 'CantOpenError', 'Connection', 'ConnectionClosedError', 'ConnectionNotClosedError', 'ConstraintError', 'CorruptError', 'Cursor', 'CursorClosedError', 'EmptyError']
3.40.1
$ python3 -m nuitka foo.py
Nuitka-Options:INFO: Used command line options: foo.py
Nuitka-Options:WARNING: You did not specify to follow or include anything but main program. Check options and make sure that is intended.
Nuitka:WARNING: Using very slow fallback for ordered sets, please install 'ordered-set' PyPI package for best Python compile time performance.
Nuitka:INFO: Starting Python compilation with Nuitka '1.5rc3' on Python '3.10' commercial grade 'not installed'.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: gcc (gcc).
Nuitka-Scons:INFO: Backend linking program with 6 files (no progress information available).
Nuitka-Scons:INFO: Compiled 19 C files using ccache.
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache hit': 12
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'called_for_link': 1
Nuitka:INFO: Keeping build directory 'foo.build'.
Nuitka:INFO: Successfully created 'foo.bin'.
$ ./foo.bin
['AbortError', 'AuthError', 'Backup', 'BindingsError', 'Blob', 'BusyError', 'CantOpenError', 'Connection', 'ConnectionClosedError', 'ConnectionNotClosedError', 'ConstraintError', 'CorruptError', 'Cursor', 'CursorClosedError', 'EmptyError']
3.40.1
$ python3 -m nuitka --standalone foo.py
Nuitka-Options:INFO: Used command line options: --standalone foo.py
Nuitka:WARNING: Using very slow fallback for ordered sets, please install 'ordered-set' PyPI package for best Python compile time performance.
Nuitka:INFO: Starting Python compilation with Nuitka '1.5rc3' on Python '3.10' commercial grade 'not installed'.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: gcc (gcc).
Nuitka-Scons:INFO: Backend linking program with 8 files (no progress information available).
Nuitka-Scons:INFO: Compiled 25 C files using ccache.
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache hit': 12
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache miss': 1
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'called_for_link': 1
Nuitka:INFO: Keeping build directory 'foo.build'.
Nuitka:INFO: Successfully created 'foo.dist/foo.bin'.
$ foo.dist/foo.bin
['__builtins__', '__compiled__', '__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
Traceback (most recent call last):
File "/space/t/foo.dist/foo.py", line 8, in <module>
File "/space/t/foo.dist/foo.py", line 5, in main
AttributeError: module 'apsw' has no attribute 'sqlitelibversion'
$ python3 -m nuitka --onefile foo.py
Nuitka-Options:INFO: Used command line options: --onefile foo.py
Nuitka:WARNING: Using very slow fallback for ordered sets, please install 'ordered-set' PyPI package for best Python compile time performance.
Nuitka:INFO: Starting Python compilation with Nuitka '1.5rc3' on Python '3.10' commercial grade 'not installed'.
Nuitka-Onefile:WARNING: Onefile mode cannot compress without 'zstandard' module installed.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: gcc (gcc).
Nuitka-Scons:INFO: Backend linking program with 8 files (no progress information available).
Nuitka-Scons:INFO: Compiled 30 C files using ccache.
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache hit': 9
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache miss': 1
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'called_for_link': 1
Nuitka-Postprocessing:INFO: Creating single file from dist folder, this may take a while.
Nuitka-Onefile:INFO: Running bootstrap binary compilation via Scons.
Nuitka-Onefile:WARNING: Onefile mode cannot compress without 'zstandard' module installed.
Nuitka-Scons:INFO: Onefile C compiler: gcc (gcc).
Nuitka-Scons:INFO: Onefile linking program with 1 files (no progress information available).
Nuitka-Scons:INFO: Compiled 4 C files using ccache.
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache hit': 2
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'called_for_link': 1
Nuitka-Onefile:INFO: Keeping onefile build directory 'foo.onefile-build'.
Nuitka:INFO: Keeping dist folder 'foo.dist' for inspection, no need to use it.
Nuitka:INFO: Keeping build directory 'foo.build'.
Nuitka:INFO: Successfully created 'foo.bin'.
$ ./foo.bin
['__builtins__', '__compiled__', '__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
Traceback (most recent call last):
File "/tmp/onefile_3538309_1675438024_993920/foo.py", line 8, in <module>
main()
File "/tmp/onefile_3538309_1675438024_993920/foo.py", line 5, in main
print(apsw.sqlitelibversion())
AttributeError: module 'apsw' has no attribute 'sqlitelibversion'
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 22 (14 by maintainers)
No, but streaming has restarting, but even within that, it may not be a priority to do this.