No module named 'math' (on self compiled Python '3.10')
See original GitHub issueHello,
from Nuitka (User Manual) I have used a sample just to give it a try. The problem is that I get an error ModuleNotFoundError: No module named ‘math’. I don’t know why Nuitka has issues with builtin random or math modules.
nuitka --standalone hello.py --run
(venv) [root@cent01 ldif-mixer]# python -m nuitka --standalone hello.py --run Nuitka-Options:INFO: Used command line options: --standalone hello.py --run Nuitka-Options:INFO: Detected static libpython to exist, consider ‘–static-libpython=yes’ for better performance, but errors may happen. Nuitka:INFO: Starting Python compilation with Nuitka ‘1.0.6’ on Python ‘3.10’ commercial grade ‘not installed’. Nuitka-Plugins:INFO: multiprocessing: Injecting pre-module load code for module ‘multiprocessing’: Nuitka-Plugins:INFO: multiprocessing: Monkey patching “multiprocessing” load environment. Nuitka-Plugins:INFO: multiprocessing: Injecting post-module load code for module ‘multiprocessing’: Nuitka-Plugins:INFO: multiprocessing: Monkey patching “multiprocessing” for compiled methods. 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 13 files (no progress information available). Nuitka-Scons:WARNING: You are not using ccache. Nuitka:INFO: Keeping build directory ‘hello.build’. Nuitka:INFO: Successfully created ‘hello.dist/hello’. Nuitka:INFO: Launching ‘hello.dist/hello’ Traceback (most recent call last): File “/usr/local/netzwert/ldif-mixer/hello.dist/hello.py”, line 11, in <module> File “/usr/local/netzwert/ldif-mixer/hello.dist/random.py”, line 49, in <module> ModuleNotFoundError: No module named ‘math’
hello.py
import random
def talk(message):
return "Talk " + message
def main():
print(talk("Hello World"))
if __name__ == "__main__":
main()
Best Regards, Kresimir
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
That is very helpful. I believe your
libpython3.10
might be miscompiled. At leaast I am using--enable-shared
or older systems, albeit all Debian, and have it working. It can be avoided by using--static-libpython=yes
in which case it may still not work, and of course will even be better for performance.Closing for lack of feedback