Running Netgen from the command line in Windows

More
6 years 4 months ago #628 by sgomes
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 <module>
from . import libngpy
ImportError: DLL load failed: The specified procedure could not be found.

Best,
Susana
More
6 years 4 months ago #629 by matthiash
That's strange...

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.
More
6 years 4 months ago #630 by sgomes
Yes, I am using Conda - When executing those commands I obtain

3.6.2 |Anaconda 4.3.1 (64-bit)| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)]


whether I run it in iPython, netgen.exe, the command window and also calling it from Matlab (because this is ultimately what I need to do).

My PYTHONPATH is

C:\Program Files\ngsolve-v6.2.1801\lib\site-packages;.

and PATH (which is also NETGENDIR):
C:\Program Files\ngsolve-v6.2.1801\bin

which were generated automatically when I installed Netgen. Is this the problem? I think it looked like this with the 1705 version before.
More
6 years 4 months ago #631 by matthiash
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:
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:
ngsolve.org/files/windows/

Best,
Matthias
More
6 years 4 months ago #632 by sgomes
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:

File "mcmc_bottleneck.py", line 28, in <module>
vertex_to_elements = [ [] for i in mesh.vertices]
AttributeError: 'ngsolve.comp.Mesh' object has no attribute 'vertices'


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.
More
6 years 4 months ago #633 by matthiash
OK, in this case I think the cause is multiple Python installations. Uninstall all but one and check again please.

Best,
Matthias
Time to create page: 0.121 seconds