problems with the docs

I am brand new to ngsolve but installed it today and and keen to learn to use it. There are a couple of problems that I found in the docs and I am not sure if it is well known or not.

First, in installing ngsolve on jupyter on my ubuntu system, I needed to install jupyter-notebook as well, and the install command did not work but needed to use enable, as copied below.

sudo apt install jupyter-notebook
jupyter nbextension enable ngsolve --user --py

Second, I found about 6 or so examples in the notebooks that did not run, the first of which was the notebook on Maxwells equations. I can provide a longer list if need be.

I presume these are known but wanted to try and contribute in case they aren’t.

Hi Poulin,

welcome to NGSolve. Yes, please tell us what is not working.

You may also watch the tutorials on youtube to see how they should work, e.g. the Maxwell tutorial:


Hello Joachim,

Thanks for sharing this video wtih me.

I understand the setup of the code but the problem I had was with an error.

In particular, I am copying the error message below. I will copy other errors that I get in the other codes in separate lines.

AttributeError Traceback (most recent call last)
5 from math import pi
6 mu0 = 4pi1e-7
----> 7 mur = mesh.MaterialCF({“magnet” : 1000}, default=1)
9 a = BilinearForm(fes)

AttributeError: ‘ngsolve.comp.Mesh’ object has no attribute ‘MaterialCF’

2.6 Stokes Equation

TypeError Traceback (most recent call last)
1 V = H1(mesh, order=2, dirichlet=“wall|inlet|cyl”)
2 Q = H1(mesh, order=1)
----> 3 X = VVQ

TypeError: unsupported operand type(s) for *: ‘ngsolve.comp.H1’ and ‘ngsolve.comp.H1’

2.11 Matrix free operator application¶

NameError Traceback (most recent call last)
2 felS = Sigma.GetFE(el)
3 felV = V.GetFE(el)
----> 4 fel = MixedFE(felS, felV)
5 trafo = mesh.GetTrafo(el)

NameError: name ‘MixedFE’ is not defined

3.3 Discontinuous Galerkin Discretizations for linear transport

TypeError Traceback (most recent call last)
1 # this does not work:
2 c2 = BilinearForm(VT)
----> 3 = c2.mat * gfu.vec

TypeError: matrix not ready - assemble bilinearform first

looks like you have an elder version of NGSolve, these are all quite new features

you can print the active version via

print (ngsolve.__version__)

current version is 2008

in the online documentation you can choose the ngsolve-version at the bottom of the menu on the left.


Thank you for the help.

When I am in a notebook and I type the line that you suggested, after importing ngsolve, I get an error

NameError Traceback (most recent call last)
1 from ngsolve import *
----> 2 print (ngsolve.version)

NameError: name ‘ngsolve’ is not defined

However, when I am in the terminal and typ in netgen I see I’m using a very old version,

$ netgen
Developed by Joachim Schoeberl at
2010-xxxx Vienna University of Technology
2006-2010 RWTH Aachen University
1996-2006 Johannes Kepler University Linz
Including OpenCascade geometry kernel
optfile ./ng.opt does not exist - using default values
togl-version : 2
OCC module loaded
loading ngsolve library
Using Lapack
Including sparse direct solver UMFPACK
Running parallel using 36 thread(s)
importing NGSolve-6.2.2007

This is what installed in ubuntu usin apt-get.

To get a newer version do you recommend I build them from source?

To get the latest version I decided to build from source. Everything seemed to go well until it was scannin gdependencies of target ngstd, and that’s where it failed because of an error. Should I post this until a different problem?

Scanning dependencies of target ngstd
[ 1%] Building CXX object ngstd/CMakeFiles/ngstd.dir/blockalloc.cpp.o
In file included from /home/fpoulin/software/ngsolve-src/ngstd/ngstd.hpp:14,
from /home/fpoulin/software/ngsolve-src/ngstd/blockalloc.cpp:12:
/home/fpoulin/software/ngsolve-src/include/ngs_stdcpp_include.hpp:43:2: error: #error “GCC 9.1/9.2 generates wrong code on AVX512 platforms (see 93009 – [9 Regression] AVX512 FMA - wrong code generation since r265288 ). Either build for a different architecture (cmake -DUSE_NATIVE=OFF), or use a different compiler (like GCC 8.3 or Clang)”
43 | #error “GCC 9.1/9.2 generates wrong code on AVX512 platforms (see 93009 – [9 Regression] AVX512 FMA - wrong code generation since r265288 ). Either build for a different architecture (cmake -DUSE_NATIVE=OFF), or use a different compiler (like GCC 8.3 or Clang)”
| ^~~~~
make[5]: *** [ngstd/CMakeFiles/ngstd.dir/build.make:63: ngstd/CMakeFiles/ngstd.dir/blockalloc.cpp.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:173: ngstd/CMakeFiles/ngstd.dir/all] Error 2
make[3]: *** [Makefile:141: all] Error 2
make[2]: *** [CMakeFiles/ngsolve.dir/build.make:116: dependencies/Stamp/ngsolve/ngsolve-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:222: CMakeFiles/ngsolve.dir/all] Error 2
make: *** [Makefile:152: all] Error 2


Concerning the apt-get version: Which Ubuntu version do you have? Note that 19.10 is already end-of-life and not receiving updates anymore.

Concerning the compiler error: Your compiler version is buggy, that’s why we had to explicitly block it. One way to work around it, is configuring cmake with
which results in sub-optimal performance of the generated code (no AVX instructions used).

I think both of your issues could be solved by an Ubuntu upgrade.


Thank you Matthias.

I will certainly get my ubuntu machine upgraded.

For the moment I have used the configuration that you suggested and have been able to install version 6.2.2008 with success. I admit that the instructions I found in the docs did not quite work in setting up the PYTHONPATH but I figured out what it should be so I’m happy about that.

I can also verify that the Maxwells example does work, and I suspect the others will work as well.

Thanks everyone for the help!