Python version: 3.10
Numpy version: 1.26.4
I’m currently working on a PySide6 project and using Nuitka to compile it (pyside6-deploy command) During the build process, I encounter a warning, and at runtime, I face an ImportError related to NumPy. Here are the details:
Build Warning
When building the project, Nuitka outputs the following warning:
Nuitka-Plugins:WARNING: dll-files: DLL configuration by filename code for ‘numpy’ did not give a result. Either conditions are missing, or this version of the module needs treatment added.
Despite this warning, the build completes successfully.
Runtime Error
However, when I execute the built project, I encounter the following ImportError:
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.
The error suggests that the project is incorrectly trying to import NumPy from its source directory, but I’ve verified that I’m not running the project from within the NumPy source directory.
Attempts to resolve
- I have confirmed that my current working directory is not the NumPy source directory
- NumPy is installed correctly, project works fine when executing the project.
- Re-installed NumPy nonetheless
- Opted for different Python version, but going further back loses support for multiple type hints and Nuitka does not play nice with higher versions.
Questions:
- How can I resolve the DLL warning from Nuitka about NumPy to ensure it’s handling the dependencies correctly?
- What could be causing the ImportError and how can I resolve it to correctly import NumPy without errors?
Damien Keijzer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.