DEV Community

Raymond Lay for MIERUNE

Posted on

Solving QGIS plugin conflict

QGIS is full of useful plugins which enlarges scope of location data analysis.

However, sometimes plugin install does not work due to the following error :

Plugin 'qgis-plugx-plugin' could not be loaded due to an error calling its classFactory() method

ImportError: cannot import name 'write_json' from 'utils' (/Users/xxxxxx/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis2web/utils.py)
Enter fullscreen mode Exit fullscreen mode

This error occured when trying to install qgis-plugx-plugin but error refers to another plugin called qgis2web in this example.

error plugin conflict

Source : https://github.com/MIERUNE/qgis-plugx-plugin/issues/160

This short article show 2 ways to solve this conflict.

Way 1 : Turn off one of contentious plugins

In plugin manager, turn off one of the plugins source of conflict.

Plugin manager

Then relaunch QGIS.
To use the other one, check/uncheck contentious plugins again and relaunch plugin.

This is not really a solution, but to solve it sustainably, you can ask plugin developer(s) by throwing an issue on plugin repository.
You can usually access to bug tracker through QGIS plugin manager,

throw issue

Way 2 : avoid using utils.py (for plugin developers)

Above error message shows that utils module seems to be source of conflicts.

[...]
ImportError: cannot import name 'write_json' from 'utils' [...]
Enter fullscreen mode Exit fullscreen mode

utils.py files from various plugins looks to be compiled in QGIS core system, and having the same module name may be source of conflict.
If you are developer of the issuing plugin, a way to solve this problem is simply to rename such a global name in root folder e.g: utils.py to yourpluginname_utils.py.

Example:
Solving

Then, peace is back between plugins!

plugin solved

Top comments (0)