You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: module 'nt' has no attribute '_add_dll_directory' #493
PS S:\windows> graalpy -m pip install numpy==1.26.4
Apr 01, 2025 7:13:16 AM org.graalvm.shadowed.org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
Looking in indexes: https://pypi.org/simple, https://www.graalvm.org/python/wheels/
Requirement already satisfied: numpy==1.26.4 in s:\windows\npt\lib\site-packages (1.26.4)
but then, when I try to import numpy:
import numpy
print ("OK")
I get:
PS S:\windows> graalpy n.py
Apr 01, 2025 7:14:23 AM org.graalvm.shadowed.org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
Traceback (most recent call last):
File "S:\windows\n.py", line 1, in <module>
import numpy
File "S:\windows\npt\Lib\site-packages\numpy\__init__.py", line 111, in <module>
_delvewheel_patch_1_10_0()
File "S:\windows\npt\Lib\site-packages\numpy\__init__.py", line 108, in _delvewheel_patch_1_10_0
os.add_dll_directory(libs_dir)
File "S:\windows\bin\graalpy-community-24.2.0-windows-amd64\graalpy-community-24.2.0-windows-amd64\Lib\os.py", line 1119, in add_dll_directory
cookie = nt._add_dll_directory(path)
AttributeError: module 'nt' has no attribute '_add_dll_directory'
With version 24.1.2 I also got this error above when importing numpy on Windows.
With version 24.2.2 I now get the following error:
org.eomasters.pyrun.PyRunnerException: org.graalvm.polyglot.PolyglotException: 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.
at org.eomasters.pyrun.PyRunner.run(PyRunner.java:30)
at org.eomasters.pyeditor.gui.PyEditor.onRun(PyEditor.java:479)
The used version is the only difference between the execution.
Hi @eomasters-repos, I could reproduce that, thank you for the report. It seems that _add_dll_directory currently doesn't work as expected. I'll open a new issue for fixing that. As a workaround, it should work when you find the numpy.libs directory and add it to the PATH variable before running GraalPy. Or rebuilding numpy from source should also work.
_add_dll_directory works in the sense that it does call the API, but it does nothing in the end because we don't set the right flags when loading libraries for it to take effect. I'm working on it.
Activity
Add an _nt core module for Windows-specific startup code. Fixes #493
Add an _nt core module for Windows-specific startup code. Fixes #493
Add an _nt core module for Windows-specific startup code. Fixes #493
eomasters-repos commentedon Aug 13, 2025
With version 24.1.2 I also got this error above when importing numpy on Windows.
With version 24.2.2 I now get the following error:
The used version is the only difference between the execution.
msimacek commentedon Aug 15, 2025
Hi @eomasters-repos, I could reproduce that, thank you for the report. It seems that
_add_dll_directorycurrently doesn't work as expected. I'll open a new issue for fixing that. As a workaround, it should work when you find thenumpy.libsdirectory and add it to thePATHvariable before running GraalPy. Or rebuilding numpy from source should also work.timfel commentedon Aug 18, 2025
I just tested
_add_dll_directoryagain and it does work, on my machine loading the dll shipped in our binary wheel simply does not work.msimacek commentedon Aug 18, 2025
_add_dll_directoryworks in the sense that it does call the API, but it does nothing in the end because we don't set the right flags when loading libraries for it to take effect. I'm working on it.