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:
[quote]Traceback (most recent call last):
line 4, in
from netgen.imex import *
File “C:\Program Files\ngsolve-v6.2.1801\lib\site-packages\netgen_init_.py”, line 17, in
from . import libngpy
ImportError: DLL load failed: The specified procedure could not be found.[/quote]
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 (trying to get Net Gen to run - Kunena) but this still hasn’t worked.
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.
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?
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.
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.
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.
It is mine, yes, and it is a Python module. Import netgen alone doesn’t work either, I get the same error described above, with the libngpy:
File “C:\Program Files\ngsolve-v6.2.1801\lib\site-packages\netgen_init_.py”, line 17, in
from . import libngpy
ImportError: DLL load failed: The specified procedure could not be found.
Could it be that you have different Python3 versions installed? Are you using Conda?
You can check the Python version by executing (once in the Python shell and once in a script run with netgen.exe):
import sys
print(sys.version)
Please also post the value of PATH and PYTHONPATH environment variables.
PATH does not contain something else?
Do you also have a usual (non-conda) Python installation (like the installation instructions suggest)? We had problems with Anaconda in the past; please try to disable/remove Anaconda and install Python from here: https://www.python.org/ftp/python/3.6.6/python-3.6.6-amd64.exe
You mentioned that the problem appeared after updating Netgen/NGSolve. Does it still work if you install the old version again? You can find old installers here: http://ngsolve.org/files/windows/
It doesn’t contain anything else Netgen related, I think.
I do have a usual python installation (I installed everything from scratch from the Netgen website), but I installed Anaconda so that I could install numpy and other things.
So, I reinstalled the 1705 version and now I can call netgen from the command line again - I just cannot run my code as this version doesn’t recognize the following:
[quote]File “mcmc_bottleneck.py”, line 28, in
vertex_to_elements = [ [] for i in mesh.vertices]
AttributeError: ‘ngsolve.comp.Mesh’ object has no attribute ‘vertices’ [/quote]
I did notice that now there are much more libraries in this folder:
C:\Program Files\ngsolve-v6.2.1705\lib
And it also seems that this was not added to the PATH, just PYTHONPATH and NETGENDIR, but it still runs codes that don’t call mesh.vertices.
I checked and I only had one version of Python - the Anaconda one.
I uninstalled it from my computer and made sure no other python versions were installed, and then installed python from the link you sent me - and I still have the same error going on…
Yes, please send me the file to matthias.hochsteger@tuwien.ac.at .
Indeed I see other possible issues on the last screenshot: Opencascade libraries are not loaded from the Netgen install dir but from a Matlab installation. Possibly that’s the cause of your problems. You could try removing “C:\Program Files\matlab\r2017a\bin\win64” from PATH (either user- or system-wide) and see if that helps.