Running Netgen from the command line in Windows

More
6 years 4 months ago #618 by sgomes
Hi,

I recently updated Netgen on my windows laptop, and even though I can run it using the Netgen interface, if I call it from the command window I get the following error:

Traceback (most recent call last):
line 4, in <module>
from netgen.imex import *
File "C:\Program Files\ngsolve-v6.2.1801\lib\site-packages\netgen\__init__.py", line 17, in <module>
from . import libngpy
ImportError: DLL load failed: The specified procedure could not be found.


It does not tell me which DLL is missing, and the libngpy file is in the correct folder. Before I updated netgen, this was working -- I had the 1705 version before.


Can you help me with this? I am using Windows 10 64bit and I tried updating the runtime support DLLs as suggested in here ( ngsolve.org/forum/ngspy-forum/25-trying-...t-net-gen-to-run#127 ) but this still hasn't worked.

Thanks!
More
6 years 4 months ago #619 by ddrake
Hi,

One thing to try that might turn on a light - You could download
Dependency Walker version 2.2 for x64 and take a look at the dependency tree for libngpy.pyd in site-packages\netgen. It should let you know about any missing dependencies.

Best,
Dow
More
6 years 4 months ago #620 by sgomes
Hi,

Thanks for this. I did it (I actually tried this before) and it tells me that I am missing DLLs of the form API-MS-..., EXT-MS-... and a couple of others which, from searching online, it looks like this is not an issue in Windows 10.

I will search more thoroughly - does the fact that I can run Netgen with the interface but not from the command line make a difference?

Thanks again,
Susana
More
6 years 4 months ago #625 by matthiash
Hi Susana,

Some API-MS-... DLL files missing in the dependency walker are usual. I think that's not the cause for your problem.

Since you mention an upgrade from 1705, I assume you installed 6.2.1806? On the other hand the error message in the command line mentions 1801. Could it be that there are multiple versions installed (this shouldn't be possible when using the MSI-Installer)?

Multiple installations of different versions would explain the behavior:
- When you launch netgen.exe it will search for all dependencies in the same directory as netgen.exe first (and find the correct ones)
- When you do 'import netgen' from Python, it will search in PYTHONPATH for the Netgen Python module (In your case finding "C:\Program Files\ngsolve-v6.2.1801\lib\site-packages\netgen\__init__.py") and in PATH for dependencies of DLLs. If they don't point to the same version, inconsistencies might occur.

Best,
Matthias
More
6 years 4 months ago #626 by sgomes
Hi Matthias,

Thanks for this. The different version is because when trying to fix this I tried to install older versions, to see if this was an issue with the latest version.

I have only one version installed (as you said, I had to uninstall previous versions in order to install the new one). And I have checked the paths, both PYTHONPATH and PATH point to the same version of Netgen (which is also the same as NETGENDIR.

Best,
Susana
More
6 years 4 months ago #627 by matthiash
In the error message above you are importing "netgen.imex". This is not a module included in Netgen, is it yours? Is it a pure python module? (In case it's written in C++ you have to recompile after a Netgen update).
Does "import netgen" alone work? If yes, I think the problem is caused by netgen.imex.

Best,
Matthias
Time to create page: 0.109 seconds