Compiling package in module mode with Anaconda 3.x produces extension module that fails to load
See original GitHub issueEnvironment Details
- Nuitka version, full Python version and Platform (Windows, OSX, Linux …)
$ python -m nuitka --version
0.6.17.3
Commercial: None
Python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:20:46)
Executable: /opt/conda/bin/python
OS: Linux
Arch: x86_64
-
How did you install Nuitka and Python
I am using Anaconda Python; Nuitka was installed via
python -m pip install nuitka
-
The specific PyPI names and versions
We have many different dependencies in this project, but here are a few:
numpy 1.20.3
pandas 1.3.4
pydantic 1.8.2
scikit-learn 0.24.2
Problem
I am new to Nuitka (very cool solution) and am trying to compile an entire package into a single executable file. I attempted to do so with a command like this, from within a directory where the code for the package (which hasn’t been otherwise installed or compiled yet) lives:
python -m nuitka --module package --include-package=package
After running that command, I find the following in my directory:
drwsrwsr-x 1 owner users 4096 Oct 24 20:52 package
drwsrwsr-x 1 owner users 65536 Oct 24 20:59 package.build
-rw-rw-r-- 1 owner users 6823728 Oct 24 21:00 package.cpython-39-x86_64-linux-gnu.so
-rw-rw-r-- 1 owner users 5819 Oct 24 21:00 package.pyi
I then take the original package
folder and rename it to to something like package_code
so as to avoid a namespace collision. If I enter a Python terminal and try to import package
, I get the following error:
ImportError: /home/user/code/package.cpython-39-x86_64-linux-gnu.so: undefined symbol: _PyObjectDict_SetItem
I can’t find much online around the error I’m having, except for something else pertaining to scikit-learn
, which is a dependency of package
. I also see that _PyObjectDict_SetItem
is mentioned in the Nuitka Roadmap.
My first question is: must I use --follow-imports
in order to Nuitka-compile all dependencies, or is it possible to Nuitka-compile only my package
, which would then make use of other .py
dependencies that it might import?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top GitHub Comments
The solution for the issue is on develop and will be part of the next release.
This is part of the 0.6.18 release.