Troubleshooting

ModuleNotFoundError: No module named ‘imfusion._bindings’

The _bindings module contains the code to interface between Python and C++ and is actually a compiled shared library. The error usually doesn’t mean that the _bindings module could not be found but that it could not be loaded. This is often caused by the following issues:

  • Your Python version is not supported.

    There are several _bindings modules, each for a different Python version, e.g. _bindings.cp36-win_amd64 is for Python 3.6 on 64bit Windows. Make sure that your Python version has a corresponding _bindings module and you are using the 64bit version of Python.

  • The dependencies cannot be loaded.

    The _bindings shared library depends on the ImFusionLib shared library which has a couple of dependencies of its own. Make sure that you set the required environment variables as described in Installation. If the problem persists you can try ldd (Linux) or Dependency Walker (Windows) to find which libraries could not be located and set LD_LIBRARY_PATH or PATH accordingly. You can also try to load the shared library directly in Python which usually gives a better error message:

    >>> import ctypes  
    >>> ctypes.WinDLL('C:\\Program Files\\ImFusion\\ImFusion Suite\\Suite\\imfusion\\_bindings.cp36-win_amd64.pyd')  
    
  • There are conflicting dependencies.

    The ImFusionLib comes with its own set of dependencies, e.g. it requires a certain version of the Qt framework. If another module now loads a different version before, the _bindings module cannot be loaded because of this version conflict. This often happens with Anaconda or other programs in the PATH environment variable. Try ldd (Linux) or Dependency Walker (Windows) to see where dependencies are loaded from.

ImportError: DLL load failed while importing _bindings

See ModuleNotFoundError: No module named ‘imfusion._bindings’

ModuleNotFoundError: No module named ‘imfusion’

This is usually caused by not setting a PYTHONPATH. The environment variable must point to the folder containing the imfusion folder and not directly to the imfusion folder!

If you are using a virtual environment, check whether you correctly mapped the module into the virtual environment.

RuntimeError: Could not create main OpenGL context

The imfusion module currently requires an OpenGL context and therefore a GPU. First thing to check is therefore that you have a GPU and a working driver. While a discrete GPU is recommended, any integrated GPU works.

If you are using Windows Remote Desktop (RDP) and a Nvidia GPU, you need to run nvidiaopenglrdp.exe which you can download from Nvidia. Otherwise, Windows Remote Desktop won’t support OpenGL. We are currently not aware of a similar solution for AMD or Intel GPUs, other than switching to a different remote desktop tool like Teamviewer or NoMachine.

This issue was also encountered on Linux when there was no X Server running, e.g. on headless server machines. As a workaround , you can start you python interpreter with``xvfb-run``. It is part of the xvfb debian package and provides a software implementation of OpenGL but will be slower in most situations.

If you are trying to run the module with docker and require proper GPU support, please contact us directly and we can provide a special build.

Floating point parameters are loaded as integers in Properties

Some Python modules change the locale of the program to e.g. German which uses , instead of . as decimal separator. You can change the locale with:

>>> import locale  
>>> locale.setlocale(locale.LC_NUMERIC, 'C')  

See https://docs.python.org/3.7/library/locale.html for details.

Extra whitespace in Windows console

On certain setups, all log messages produced by the ImFusionLib contain a extra space after every character, l i k e t h i s. This seems to be an issue with Python changing the console mode from O_TEXT to O_BINARY and log4cxx messing up the encoding. As a workaround you can redirect the logging messages to the Python logging module (see Logging).

The IPython console only prints “ERROR: execution aborted”

This seems to be a bug in IPython. Make sure you have the latest version of ipython and ipykernel installed.