Python Debugging Issue: Enable native code debugging is causing most of packages import failure.
This issue has been moved from a ticket on Developer Community.
[severity:I’m unable to use this version] [regression] [worked-in:17.13.3]
Solution Explorer -> Properties -> Debug -> Enable native code debugging
When doing so, most of Packages are unable to import, for example numpy, etc.
This problem only appears in recent realeases.
Python3.11, debugging symbols are installed and downloaded, packages and codes run normally when “Enable native code debugging” disabled, and it can runs well with that enabled when no package is imported.
Try import numpy in your visul studio with the button of “Enable native code debugging” on, and you may see this:
Traceback (most recent call last):
File "C:\Program Files\Python311\Lib\site-packages\numpy_core_init_.py", line 23, in <module>
from . import multiarray
File "C:\Program Files\Python311\Lib\site-packages\numpy_core\multiarray.py", line 10, in <module>
from . import overrides
File "C:\Program Files\Python311\Lib\site-packages\numpy_core\overrides.py", line 7, in <module>
from numpy._core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy._core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program Files\Python311\Lib\site-packages\numpy_init_.py", line 127, in <module> from numpy.config import show_config File "C:\Program Files\Python311\Lib\site-packages\numpy_config_.py", line 4, in <module> from numpy._core.multiarray_umath import ( File "C:\Program Files\Python311\Lib\site-packages\numpy_core_init.py", line 49, in <module> raise ImportError(msg) ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
- The Python version is: Python3.11 from "C:\Program Files\Python311\python_d.exe"
- The NumPy version is: "2.2.4"
and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy._core._multiarray_umath'
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "F:\source\311312test\311312test_311312test.py", line 2, in <module> import numpy as np File "C:\Program Files\Python311\Lib\site-packages\numpy_init_.py", line 132, in <module> raise ImportError(msg) from e 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. >>>
Original Comments
Feedback Bot on 3/23/2025, 10:23 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Changing to python_d.exe indeed makes no sense and is not needed for mixed or native mode debugging, from the page:
Debug build on Windows
Rather than building your project in DEBUG mode on windows, try building in RELEASE mode with debug symbols and no optimization. Full DEBUG mode on windows changes the names of the DLLs python expects to find, so if you wish to truly work in DEBUG mode you will need to recompile the entire stack of python modules you work with including NumPy
-c "import numpy" should be enough to repro this.