- Thank you received: 31
PIP installers available!
1 year 11 months ago #4558
by matthiash
Replied by matthiash on topic PIP installers available!
Hello Sgroi,
I could reproduce the problem on Windows. One possible workaround is to do the following:
I just added these lines to the ngsolve sources, a new nightly pip build will be released later today.
Note that the conda channel ngsolve is not maintained, pip is the preferred way to install ngsolve.
Best,
Matthias
I could reproduce the problem on Windows. One possible workaround is to do the following:
Code:
import netgen,os
netgen_dir = os.path.dirname(netgen.__file__))
os.add_dll_directory(netgen_dir)
os.path["PATH"] += os.pathsep + netgen_dir
import ngsolve
I just added these lines to the ngsolve sources, a new nightly pip build will be released later today.
Note that the conda channel ngsolve is not maintained, pip is the preferred way to install ngsolve.
Best,
Matthias
- paul.stocker
- Offline
- New Member
Less
More
- Thank you received: 0
1 year 11 months ago #4559
by paul.stocker
Replied by paul.stocker on topic PIP installers available!
Hi Sgroi & Matthias,
thank you for your reply!
For me, the import of netgen already fails, so this does not solve it in my case. My error is:
import netgen
File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\netgen\__init__.py", line 18, in <module>
from . import libngpy
ImportError: DLL load failed while importing libngpy: The specified module could not be found.
I put the site_package dir and even the netgen and ngsolve dir into my PATH and PYTHONPATH, is there any other variable I should be aware of so python can find the files?
Weirdly enough, the __init__ of netgen can import the config file but fails on the libngpy.
I then tried to import libngpy from inside the config file and it worked.... wat? (But still failing to import libngs later on...)
Bests,
Paul
thank you for your reply!
For me, the import of netgen already fails, so this does not solve it in my case. My error is:
import netgen
File "C:\Users\IEUser\AppData\Local\Programs\Python\Python310\lib\site-packages\netgen\__init__.py", line 18, in <module>
from . import libngpy
ImportError: DLL load failed while importing libngpy: The specified module could not be found.
I put the site_package dir and even the netgen and ngsolve dir into my PATH and PYTHONPATH, is there any other variable I should be aware of so python can find the files?
Weirdly enough, the __init__ of netgen can import the config file but fails on the libngpy.
I then tried to import libngpy from inside the config file and it worked.... wat? (But still failing to import libngs later on...)
Bests,
Paul
- maurosgroi
- New Member
Less
More
1 year 11 months ago #4560
by maurosgroi
Replied by maurosgroi on topic PIP installers available!
Dear Matthias,
I tried your solution but I get the following error:
os.path["PATH"] += os.pathsep + netgen_dir
TypeError: 'module' object is not subscriptable
How should I proceed?
Thanks a lot and best regards,
Mauro Sgroi.
I tried your solution but I get the following error:
os.path["PATH"] += os.pathsep + netgen_dir
TypeError: 'module' object is not subscriptable
How should I proceed?
Thanks a lot and best regards,
Mauro Sgroi.
1 year 11 months ago #4561
by matthiash
Replied by matthiash on topic PIP installers available!
Oh, I had a typo there, the line should be
os.environ["PATH"] += os.pathsep + netgen_dir
Best,
Matthias
os.environ["PATH"] += os.pathsep + netgen_dir
Best,
Matthias
- maurosgroi
- New Member
Less
More
1 year 11 months ago - 1 year 11 months ago #4562
by maurosgroi
Replied by maurosgroi on topic PIP installers available!
Dear Matthias,
now I can import properly ngsolve.
I still have an issue with the first problem of the tutorial, the Poisson example. I modified the Jupyter notebook as follows:
import netgen,os
netgen_dir = os.path.dirname(netgen.__file__)
os.add_dll_directory(netgen_dir)
os.environ["PATH"] += os.pathsep + netgen_dir
from ngsolve import *
#from netgen.geom2d import unit_square
from netgen.occ import unit_square
from ngsolve.webgui import Draw
but executing Draw (gfu, mesh) I get the following error:
TypeError Traceback (most recent call last)
Cell In [7], line 1 ----> 1 Draw (gfu, mesh)
TypeError: Draw(): incompatible function arguments. The following argument types are supported:
1. (cf: ngsolve.fem.CoefficientFunction, mesh: ngsolve.comp.Mesh, name: str, sd: int = 2, autoscale: bool = True, min: float = 0.0, max: float = 1.0, draw_vol: bool = True, draw_surf: bool = True, reset: bool = False, **kwargs) -> None
2. (gf: ngsolve.comp.GridFunction, sd: int = 2, autoscale: bool = True, min: float = 0.0, max: float = 1.0, **kwargs) -> None
3. (mesh: ngsolve.comp.Mesh, **kwargs) -> None
4. (arg0: object) -> None
Invoked with: <ngsolve.comp.GridFunction object at 0x000001ECA9D6D860>, <ngsolve.comp.Mesh object at 0x000001ECA9C3CDB0>
So essentially I cannot plot the solution.
Thanks a lot in advance and best regards,
Mauro.
now I can import properly ngsolve.
I still have an issue with the first problem of the tutorial, the Poisson example. I modified the Jupyter notebook as follows:
import netgen,os
netgen_dir = os.path.dirname(netgen.__file__)
os.add_dll_directory(netgen_dir)
os.environ["PATH"] += os.pathsep + netgen_dir
from ngsolve import *
#from netgen.geom2d import unit_square
from netgen.occ import unit_square
from ngsolve.webgui import Draw
but executing Draw (gfu, mesh) I get the following error:
TypeError Traceback (most recent call last)
Cell In [7], line 1 ----> 1 Draw (gfu, mesh)
TypeError: Draw(): incompatible function arguments. The following argument types are supported:
1. (cf: ngsolve.fem.CoefficientFunction, mesh: ngsolve.comp.Mesh, name: str, sd: int = 2, autoscale: bool = True, min: float = 0.0, max: float = 1.0, draw_vol: bool = True, draw_surf: bool = True, reset: bool = False, **kwargs) -> None
2. (gf: ngsolve.comp.GridFunction, sd: int = 2, autoscale: bool = True, min: float = 0.0, max: float = 1.0, **kwargs) -> None
3. (mesh: ngsolve.comp.Mesh, **kwargs) -> None
4. (arg0: object) -> None
Invoked with: <ngsolve.comp.GridFunction object at 0x000001ECA9D6D860>, <ngsolve.comp.Mesh object at 0x000001ECA9C3CDB0>
So essentially I cannot plot the solution.
Thanks a lot in advance and best regards,
Mauro.
Last edit: 1 year 11 months ago by maurosgroi.
- paul.stocker
- Offline
- New Member
Less
More
- Thank you received: 0
1 year 11 months ago - 1 year 11 months ago #4563
by paul.stocker
Replied by paul.stocker on topic PIP installers available!
Hi Mauro,
you have to pass a string as name for the function in the third argument. Something like
Draw (gfu, mesh, "gfu")
should work.
Also, in case you want the drawing to show up in the notebook (and not in the netgen gui) you need to install the webgui, you can find the instructions here:
docu.ngsolve.org/latest/i-tutorials/index.html
Can you tell me which python version and ngsolve version you are using? I still cannot import netgen.
Cheers, Paul
you have to pass a string as name for the function in the third argument. Something like
Draw (gfu, mesh, "gfu")
should work.
Also, in case you want the drawing to show up in the notebook (and not in the netgen gui) you need to install the webgui, you can find the instructions here:
docu.ngsolve.org/latest/i-tutorials/index.html
Can you tell me which python version and ngsolve version you are using? I still cannot import netgen.
Cheers, Paul
Last edit: 1 year 11 months ago by paul.stocker.
Time to create page: 0.108 seconds