Hi! I’ve stumbled upon some user having DLL load failed while importing bsdf: A dynamic link library (DLL) initialization routine failed. error when they import pyradiance library.
The library itself is not important, I guess it’s more general question on how to narrow it down and fix.
There’s a bit of investigation by the link above, I’ll summarize things we tried:
the problem started with Python bundled with Blender, but it can reproduced by user with import pyradiance in their system Python 3.11
Microsoft Visual C++ Redistributable is up to date
bsdf.pyd dependencies, the only file that’s failing to load - link to image
running python -v -c "import pyradiance" got us no clues. Link
user’s msvcp140.dll version matches with mine, so it shouldn’t be a problem - link
user recorded procmon logs on import pyradiance - link, but couldn’t narrow down the issue based on those logs. The only thing I’ve noticed is:
From the logs it seems to find MSVCP140.dll just fine from System32 and VCRUNTIME140_1.dll from Python directory, but it never gets to VCRUNTIME140.dll (doesn’t even check if it exists and never fails, on my system it’s checking python311.dll and then VCRUNTIME140.dll right after finishing with VCRUNTIME140_1.dll and MSVCP140.dll ).
Any other clues we’ve missed or other things to try out?
I’ll invite user with this issue here, so they can try new suggestions in their environment. Perhaps, we’ll be able to solve it.
What else is installed in Blender’s Python 3.11? Does Blender’s Python allow the user to create venvs? I’ve done a lot with Rhino, and a frequent issue for users (before Python 3 and venvs were supported) was dependency clashes between different third party plug-ins, all sharing the same Python environment. 4 times out of 10, Numpy was involved.
I am one of the ones having the issue with the pyradiance in various blender versions it’s strange only one specific plugin/addon while every other addon works perfectly fine.
I have linked the logs that were given, they can be found at the link where Andrej used but just in case it makes it easier to see: first one is a Logfile.PML file, the second is a text file containing the log that was given in python itself.
it took me awhile as i had some issues to sort out, i had to set python back to 3.11 in the environment path because for some reason it keeps going back to 3.13 even though pyradiance is set to 3.11.
anyway, i did all the steps mentioned and it gave this:
LoadLibrary C:\Users\.....\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyradiance\bsdf.cp311-win_amd64.pyd
LoadLibrary C:\Windows\System32\msvcp140.dll
LoadLibrary C:\Users\.....\AppData\Local\Programs\Python\Python311\vcruntime140_1.dll
LoadLibrary C:\Users\.....\AppData\Local\Programs\Python\Python311\vcruntime140_1.dll
Failed \Device\HarddiskVolume3\Users\.....\AppData\Local\Programs\Python\Python311\vcruntime140_1.dll
Failed \Device\HarddiskVolume3\Windows\System32\msvcp140.dll
Failed \Device\HarddiskVolume3\Users\.....\AppData\Local\Programs\Python\Python311\vcruntime140_1.dll
Failed \Device\HarddiskVolume3\Users\.....\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyradiance\bsdf.cp311-win_amd64.pyd
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\.....\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyradiance\__init__.py", line 15, in <module>
from .bsdf import spec_xyz, xyz_rgb
ImportError: DLL load failed while importing bsdf: A dynamic link library (DLL) initialization routine failed.
i checked and it did have a difference in the hash between the python version and system version, but i corrected that and im still getting the same issue.
LoadLibrary C:\Users\.....\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyradiance\bsdf.cp311-win_amd64.pyd
LoadLibrary C:\Windows\System32\msvcp140.dll
LoadLibrary C:\Users\.....\AppData\Local\Programs\Python\Python311\vcruntime140_1.dll
Failed \Device\HarddiskVolume3\Windows\System32\msvcp140.dll
Failed \Device\HarddiskVolume3\Users\.....\AppData\Local\Programs\Python\Python311\vcruntime140_1.dll
Failed \Device\HarddiskVolume3\Users\.....\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyradiance\bsdf.cp311-win_amd64.pyd
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\.....\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyradiance\__init__.py", line 15, in <module>
from .bsdf import spec_xyz, xyz_rgb
ImportError: DLL load failed while importing bsdf: A dynamic link library (DLL) initialization routine failed.
from what i can see it does look similar in stuff trying to load but failing, but i do not think it is cpu related as tests show that the dlls load but not when pyradiance does it so it, however i am not knowledgeable enough to know for sure.
here is what intel software development emulator gave:
Traceback (most recent call last): File “”, line 1, in File “C:\Users.…\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyradiance_init_.py”, line 14, in with dlltracer.Trace(out=sys.stdout): File “_native.pyx”, line 300, in dlltracer._native.Trace.enter File “_native.pyx”, line 321, in dlltracer._native.Trace.start File “_native.pyx”, line 201, in dlltracer._native._check PermissionError: [WinError 5] failed to start trace (0x00000005)