Windows installation: DLL error pyngcore

As I want to use ngsolve with the students in my course, I tested the installation in Windows by pip. Unfortunately, I struggle with the installation in Windows, while it works fine in Linux. I have tested with python 3.10, 3.11 and 3.12 with a clean installation, I added the path to the scripts. I followed the instructions on Downloads and tested alternative instructions from the forum with the option --pre mentioned in a recent post. In any case I get an ImportError: DLL load failed while importing pyngcore.


I would appreciate any help.

can you start Python, and then import as

import ngsolve
import netgen.gui

Joachim

Thanks for your reply. I get basically the same error messages for import ngsolve. The first lines slightly differ but the last three lines are identical. I guess that the problem is specific to the used machine. It is not important that I can run ngsolve on that specific machine.
Today I have installed ngsolve on two other Windows machines. On both machines I can run ngsolve.
A small question: On both machines the menu entry Solve next to Help in the menu bar is not available in Windows. On Linux I still have that entry. Is this intended?

Thanks for the support.
Best regards
Günther

Just an update: Yesterday I have installed ngsolve on a student’s windows machine with the same commands as before. There the menu entry Solve next to Help in the menu bar is available. I don’t get it.

Can you send us some ideas of what might be differences between machines? Python versions? Did you use python installer or some environment like conda? The entry should be there, if it is not it is because the gui does not find the ngsolve-tcl files that should be installed alongside with ngsolve. do you find the ngsolve.tcl file somewhere? You can try to copy this file to the folder where netgen exe is located.

Dear Christopher,

thanks for your advice. Copying the file textngsolve.tcl to the directory of netgen.exe fixed the issue.
I do not have access to the student’s machine. Thus I had to wait until I had access to a another machine to figure out the difference:

  • Machine 1: installation of python by the python installer from python.org. The file ngsolve.tcl is in the same folder as netgen.exe: AppData/Local/Programs/Python/Python312/Scripts
  • Machine 2: installation of python from Microsoft Store and adding .../local-packages/Python312/Scripts to the path: Python ends up in a different folder. But the relevant difference seems to be that ngsolve.tcl is in the folder .../local-packages/Scripts while all other scripts (including netgen.exe) are in .../local-packages/Python312/Scripts. Thus your advice fixed the issue.

Thanks for your support.
Best regards,
Günther

I guess this is an old post, but for anyone else that wants to use Windows, I highly recommend to use the WSL (Windows Subsystem Linux). It basically creates an Ubuntu Linux that you can run as a terminal.

I have instructions here for how to install NGSolve under WSL: