Install Problem - No module named 'netgen'

Hello everybody,

after some time away from ngsolve I wanted to do some computation for which I tried to install netgen/ngsolve on my private PC. I run Linux Mint 20.1 and therefore followed your build on linux instructions. However, after calling make I get the error “No module named ‘netgen’”; more specific:

Traceback (most recent call last): File "/usr/lib/python3.8/", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/", line 87, in _run_code exec(code, run_globals) File "/home/phil/.local/lib/python3.8/site-packages/pybind11_stubgen/", line 4, in <module> main() File "/home/phil/.local/lib/python3.8/site-packages/pybind11_stubgen/", line 915, in main _module = ModuleStubsGenerator(_module_name) File "/home/phil/.local/lib/python3.8/site-packages/pybind11_stubgen/", line 666, in __init__ self.module = importlib.import_module(module_or_module_name) File "/usr/lib/python3.8/importlib/", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'netgen' CMake Error at python/cmake_install.cmake:59 (file): file INSTALL cannot find "/home/phil/Programme/NGSolve/ngsolve-build/netgen/netgen/python/../stubs/netgen-stubs": No such file or directory.

As I am still a bit of a newcomer to linux I don’t really know how to resolve this problem (or even where to start).
Already thanks for any help.


Hi Philipp,

it looks to me as if the error is occurring when the stubfiles for autocompletion in an editor are attempted to be generated. Maybe try building without them, i.e., set the make option -DBUILD_STUB_FILES=OFF Otherwise I would try setting the all the necessary environment variables in your .bashrc before building and compiling ngsolve.

Best wishes,

Hi Henry,

thanks for your advice - make runs through just fine, however I get the same message when calling ‘make install’:

[code]-- Installing: /home/phil/Programme/NGSolve/ngsolve-build/ngsolve-install/lib/python3/dist-packages/ngsolve/labextension/package.json
Traceback (most recent call last):
File “/usr/bin/jupyter-nbextension”, line 11, in
load_entry_point(‘notebook==6.0.3’, ‘console_scripts’, ‘jupyter-nbextension’)()
File “/usr/lib/python3/dist-packages/jupyter_core/”, line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File “/usr/lib/python3/dist-packages/traitlets/config/”, line 664, in launch_instance
File “/usr/lib/python3/dist-packages/notebook/”, line 983, in start
super(NBExtensionApp, self).start()
File “/usr/lib/python3/dist-packages/jupyter_core/”, line 259, in start
File “/usr/lib/python3/dist-packages/notebook/”, line 711, in start
File “/usr/lib/python3/dist-packages/notebook/”, line 682, in install_extensions
full_dests = install(self.extra_args[0],
File “/usr/lib/python3/dist-packages/notebook/”, line 206, in install_nbextension_python
m, nbexts = _get_nbextension_metadata(module)
File “/usr/lib/python3/dist-packages/notebook/”, line 1117, in _get_nbextension_metadata
m = import_item(module)
File “/usr/lib/python3/dist-packages/traitlets/utils/”, line 42, in import_item
return import(parts[0])
ModuleNotFoundError: No module named ‘ngsolve’
Error in sys.excepthook:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/”, line 153, in apport_excepthook
with os.fdopen(,
FileNotFoundError: [Errno 2] No such file or directory: ‘/var/crash/_usr_bin_jupyter-nbextension.1000.crash’


Any further ideas how to resolve this?


You need to add

export PYTHONPATH=$PYTHONPATH:/home/phil/Programme/NGSolve/ngsolve-build/ngsolve-install/lib/python3/dist-packages/

in your ~/.bashrc

and start a new terminal.

best Christopher

Hello Christopher,

I already tried your solution but to no avail. However, it seems that my problem was correlated to jupyter - can’t exactly point it out, but after a fresh installation of jupyter it works now.

Thanks for your help anyways :slight_smile: