WebGUI issue

I am trying to run this code on an M2 Mac-air with HomeBrew Python 3.12.3 and NGSolve-6.2.2403:

from ngsolve import *
from netgen.occ import unit_square
from ngsolve.webgui import Draw
mesh = Mesh(unit_square.GenerateMesh(maxh=0.2))
Draw (mesh);

In Jupyter Notebook I get the error message

WebGuiWidget(layout=Layout(height=‘50vh’, width=‘100%’), value={‘gui_settings’: {}, ‘ngsolve_version’: '6.2.24…

and no graphic. Can you suggest a workaround?


Hi Peter,
did you try

pip install --upgrade webgui_jupyter_widgets

it seems it is missing the jupyter widgets package.

Thanks for the response!

I did already run the above, but I guess I am not sure if the version of Python used by Jupyter is correct.

I ran the online code

import webgui_jupyter_widgets
from packaging.version import parse
assert parse(webgui_jupyter_widgets.version) >= parse(“0.2.18”)
print(‘Everything good!’)
print(“\x1b[31mYou need to update webgui_jupyter_widgets by running: \x1b[0m\npython3 -m pip install --upgrade webgui_jupyter_widgets”)

and got the response “Everything good!”

Hi Peter,

Depending on your jupyter version, you might also need following commands:

jupyter nbextension install --user --py webgui_jupyter_widgets
jupyter nbextension enable --user --py webgui_jupyter_widgets

Apart from that, I would check if the “pip3” command you are using belongs to the correct python version (which is running inside jupyter).
which pip3 shows the path to the command you are running.
In jupyter, you can get the path to python with

import sys

In case they are pointing to different python installations, try running

pip3 uninstall webgui_jupyter_widgets
correct_python -m pip install --upgrade webgui_jupyter_widgets