DLL load failed while importing ngslib: A dynamic link library (DLL) initialization routine failed

Hi,

a few of my students get the error during the import of ngsolve after an error-free installation of ngsolve:

ImportError: DLL load failed while importing ngslib: A dynamic link library (DLL) initialization routine failed.

They are using Windows 11 but not everyone has the problem. A student has successfully installed ngsolve with python3.12 under Windows 11 on a notebook, but on the PC also with Windows 11 and python3.11 /3.12 with the above error.

Does anyone know the problem and a solution :upside_down_face:? I suspect that some environment variable is not set correctly. Unfortunately, I cannot reconstruct the problem as I am using MacOS or Ubuntu.

Best regards

Simon Stingelin.

installation with pip, installer or self built? most often this error is coming from a second installation of ngsolve and python loading incompatible dlls between py bindings and ngslib.
best Christopher

They used pip install with .org python distribution (cf. upload).

NGSolveInstalation.pdf (183.9 KB)

I will ask the students for second installations.

Best regards, Simon.

Hi Simon,

I encountered the same issue as your students with a pip install and python 3.12, which led me to your post.

I tried a few things, but the only thing that actually worked is wiping ngsolve/python installations clean and downloading the windows .msi installer and python 3.7. After that, everything works fine!

There is the possibility that pip installation and python 3.7 might also work, but I did not try that specific combination.

I also have the same issue.
I tried just pip install and not going through windows .msi installer.
The issue occurs with windows machines. The usual pip install works fine in Ubuntu/linux.

Any solution so far such that it works for windows as well .

ImportError: DLL load failed while importing ngslib: A dynamic link library (DLL) initialization routine failed.

Thanks

can you try the nightly build?

pip install --pre ngsovle

I think this might be fixed with a recent commit.

Thanks a lot. Now it works.