I'm using pyinstaller and staticx to compile a Python3.6 script to static binary. I've installed all packages via pip in a virtual environment (venv).
Everything works fine until I try to add the line import networkit as nk to the top of my script. Compilation still works, but once I run the otherwise unchanged file, I get the following error:
File "StrategicSolver.py", line 15, in <module>
import networkit as nk
File "<my_path>/strat_solver_env/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "networkit/__init__.py", line 50, in <module>
File "<my_path>/strat_solver_env/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "networkit/graph.py", line 2, in <module>
File "networkit/_NetworKit.pyx", line 6, in init networkit._NetworKit
ModuleNotFoundError: No module named 'networkit.exceptions'
[19811] Failed to execute script StrategicSolver
The module 'networkit.exceptions' should be there (I've also tried installing the package from source via python3 setup.py install), so I'm not sure what's going on. I don't have much experience building static binaries from Python so any help would be greatly appreciated.
I was able to find a temporary workaround by cloning the repository and commenting out any line in _NetworKit.pyx that relies on 'networkit.exceptions' (see below).
From there on, build from source as described in their installation guide.