Pb import ngsolve

More
4 years 5 months ago #2865 by mallej
Pb import ngsolve was created by mallej
Hello,

I encounter an error while execution this command :

>>> from ngsolve import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ngsolve/__init__.py", line 13, in <module>
from .ngslib import __version__, ngstd, bla, la, fem, comp, solve
ImportError: cannot import name 'fem' from 'ngsolve' (/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ngsolve/ngslib.so)

I installed ngsolve via macports :

ngsolve @6.2.2004 (math)
NGSolve Finite Element Library

My configuration is a MacbookAir with Catalina 10.15.4

According to the line : from .ngslib import __version__, ngstd, bla, la, fem, comp, solve
and the error message, I tried :
nicolas$ nm -g /opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ngsolve/ngslib.so | grep fem

and I obtain :

U __Z11ExportNgfemRN8pybind116moduleE

so it seems there is no symbol fem in this .so

Thanks for your help

Nicolas.
More
4 years 5 months ago #2866 by hvwahl
Replied by hvwahl on topic Pb import ngsolve
Hi Nicolas,

since there is no reference to the macports port on the NGSolve website, I'm guessing that this is not an official build. It's probably easiest to use the dmg provided in the downloads section to get a working copy of NGSolve.

Best wishes
Henry
More
4 years 5 months ago #2867 by mallej
Replied by mallej on topic Pb import ngsolve
Hello Henry,

Thanks for your advice ! it helped me a lot to find a solution.

Before my mail on the forum, I had tried to used directly the dmg but the application didn't worked. So I tried using the macports.

Thanks to your mail, I came back to the dmg : the reason was that netgen searches Python in /Library/Frameworks and as I used a python installed with macports it was in /opt/local/Library/Frameworks so netgen didn't find it. So I followed your advice :

- I uninstalled netgen and netsolve via macports
- I re-installed netgen via the dmg file
- I made a symbolic link :
"ln -s /opt/local/Library/Frameworks/Python.framework" in /Library/Frameworks
... and it worked !

So even if netgen and netsolve exists under macports, it seems not to be the usual way to use netgen as you said !

Thanks a lot !

Nicolas.
More
4 years 5 months ago #2868 by christopher
Replied by christopher on topic Pb import ngsolve
The macports installers are not created/maintained by us. If you have troubles with them I guess you need to write to their bugtracker.
Good that you got it working with the dmg :)
Time to create page: 0.108 seconds