Import Error when called from other than the NGSolve GUI

More
4 years 7 months ago #2550 by jleman
I just updated to NGS 6.2.2003 (Windows 10 machine with Anaconda python 3.7). I get the error below if I run this in jupyter or an IDE like Spyder, but not when executed from a python call from inside the NGSolve gui. I'd like to be able to run scripts in Jupyter. Any suggestions for how to fix this?

Thanks.
Code:
import netgen.gui from ngsolve import * from netgen.geom2d import unit_square

Code:
--------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-2-76ebde58f411> in <module> 1 import netgen.gui ----> 2 from ngsolve import * 3 from netgen.geom2d import unit_square C:\Program Files\ngsolve-v6.2.2003\lib\site-packages\ngsolve\__init__.py in <module> 11 """ 12 import netgen ---> 13 from .ngslib import __version__, ngstd, bla, la, fem, comp, solve 14 15 from netgen import Redraw ImportError: DLL load failed: The specified procedure could not be found.
More
4 years 7 months ago #2558 by christopher
Do you use the new anaconda installers?
The following user(s) said Thank You: jleman
More
4 years 7 months ago #2559 by jleman
I updated to the latest ngsolve package (2003) from within the Anaconda navigator. Would that have picked up the right components?
More
4 years 7 months ago #2560 by christopher
That depends. Have you had another ngsolve installed before? If yes you have to remove that one first. Then it should work.
The following user(s) said Thank You: jleman
More
4 years 7 months ago #2565 by jleman
Ok, I worked through the suggestions above and things seemed to be working. I started with the poisson example in Jupyter notebook. All cells seem to execute properly except the Draw(gfu) function. As I understand from the documentation this is supposed to show results in a popup window? In my case nothing happens. I did notice that even though the first cell (below) seems to execute fine, the following error shows up in the command prompt window. Is it possible they are related and any suggestions for resolving the error? I am using Python 3.7.7.
Code:
import netgen.gui from ngsolve import * from netgen.geom2d import unit_square
Code:
ERROR:tornado.application:Exception in callback functools.partial(<function Kernel.enter_eventloop.<locals>.advance_eventloop at 0x000001E799E55708>) Traceback (most recent call last): File "c:\users\jon\appdata\local\programs\python\python37\lib\site-packages\tornado\ioloop.py", line 743, in _run_callback ret = callback() File "c:\users\jon\appdata\local\programs\python\python37\lib\site-packages\ipykernel\kernelbase.py", line 314, in advance_eventloop eventloop(self) File "c:\users\jon\appdata\local\programs\python\python37\lib\site-packages\ipykernel\eventloops.py", line 232, in loop_tk app.tk.createfilehandler(stream.getsockopt(zmq.FD), READABLE, notifier) AttributeError: '_tkinter.tkapp' object has no attribute 'createfilehandler'
More
4 years 7 months ago #2575 by christopher
As explained in the documentation, this is a problem with recent ipykernel versions in Windows:
ngsolve.org/docu/latest/install/usejupyter.html

You have to downgrade your ipykernel:
Code:
pip install ipykernel==4.10.0

Best
Christopher
The following user(s) said Thank You: jleman
Time to create page: 0.105 seconds