Windows Debug Build GIL Error When Importing Torch

Hi everyone. Does anyone know the correct way of building PyTorch in Debug mode on Windows? I’ve been able to build using set DEBUG=1 and running python setup.py develop with also setting the LIB env variable to the Python libs, but this causes the following error when running import torch with Python:

Fatal Python error: _PyInterpreterState_GET: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL)

The error above happens with no stack trace.

After running import torch with python_d.exe the GIL error is not present, however I get an ImportError related to numpy (attached screenshot). This is probably due to some of the dependencies (like numpy) being in Release mode, because they were just installed with pip install.Have I done something wrong? Is there any way to build PyTorch in full Debug mode on Windows, rather than in Release with Debug symbols (Fail to build debug version on windows, Fail to "import torch" on Windows debug build)?

I tried following the suggestions from the error without success.
These errors happen in plain system Python installation, venv and conda env.