Install Problem - No module named 'netgen'

1 month 1 week ago #3643 by PKonig
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/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/phil/.local/lib/python3.8/site-packages/pybind11_stubgen/__main__.py", line 4, in <module>
    main()
  File "/home/phil/.local/lib/python3.8/site-packages/pybind11_stubgen/__init__.py", line 915, in main
    _module = ModuleStubsGenerator(_module_name)
  File "/home/phil/.local/lib/python3.8/site-packages/pybind11_stubgen/__init__.py", line 666, in __init__
    self.module = importlib.import_module(module_or_module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", 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.

Greetings,
Philipp

Please Log in or Create an account to join the conversation.

1 month 1 week ago #3646 by hvwahl
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,
Henry

Please Log in or Create an account to join the conversation.

1 month 1 week ago #3647 by PKonig
Hi Henry,

thanks for your advice - make runs through just fine, however I get the same message when calling 'make install':
-- 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 <module>
    load_entry_point('notebook==6.0.3', 'console_scripts', 'jupyter-nbextension')()
  File "/usr/lib/python3/dist-packages/jupyter_core/application.py", line 270, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/lib/python3/dist-packages/notebook/nbextensions.py", line 983, in start
    super(NBExtensionApp, self).start()
  File "/usr/lib/python3/dist-packages/jupyter_core/application.py", line 259, in start
    self.subapp.start()
  File "/usr/lib/python3/dist-packages/notebook/nbextensions.py", line 711, in start
    self.install_extensions()
  File "/usr/lib/python3/dist-packages/notebook/nbextensions.py", line 682, in install_extensions
    full_dests = install(self.extra_args[0],
  File "/usr/lib/python3/dist-packages/notebook/nbextensions.py", line 206, in install_nbextension_python
    m, nbexts = _get_nbextension_metadata(module)
  File "/usr/lib/python3/dist-packages/notebook/nbextensions.py", line 1117, in _get_nbextension_metadata
    m = import_item(module)
  File "/usr/lib/python3/dist-packages/traitlets/utils/importstring.py", 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/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_jupyter-nbextension.1000.crash'

Any further ideas how to resolve this?

Greetings,
Philipp

Please Log in or Create an account to join the conversation.

1 month 1 week ago #3648 by christopher
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

Please Log in or Create an account to join the conversation.

1 month 1 week ago #3649 by PKonig
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 :)

Greetings,
Philipp

Please Log in or Create an account to join the conversation.

© 2019 Netgen/NGSolve