Skip to content

Cannot install plugin: TypeError 'type' object is not subscriptable on QGIS 3.22 (Python 3.8) due to dict[...] annotation #778

@RastoHu

Description

@RastoHu

Description

Unable to install Mergin Maps plugin (build b105211). Plugin installation fails at classFactory with:
TypeError: 'type' object is not subscriptable
Cause appears to be use of PEP 585 built‑in generic annotation (dict[str, str]) in mergin/client.py, which is not supported in Python 3.8 used by QGIS 3.22 without postponed evaluation of annotations.

Environment
Staging

Application (+ app version, build, operating system)

  • QGIS version: 3.22.10-Białowieża
  • Plugin version: 2025.3.2 (build b105211)
  • OS: macOS, Sequoia 15.6
  • Python: 3.8.7

Steps to reproduce

  1. Launch QGIS 3.22.10 on macOS.
  2. Install to Mergin Maps plugin build b105211 (2025.3.2) from ZIP.
  3. Observe error.

Actual results

Plugin cannot be installed (initialized). Error dialog:
Couldn't install plugin 'Mergin' due to an error when calling its classFactory() method
TypeError: 'type' object is not subscriptable

Traceback shows failure at method definition:
def post(..., query_params: dict[str, str] = None):

Expected results

Plugin installs successfully in supported QGIS versions, or installation is blocked with a clear message if QGIS 3.22 (Python 3.8) is no longer supported.

Screenshots or logs

Full traceback:

Couldn't load plugin 'Mergin' due to an error when calling its classFactory() method 

TypeError: 'type' object is not subscriptable 
Traceback (most recent call last):
  File "/Applications/QGIS-LTR 2.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Mergin/__init__.py", line 6, in classFactory
    from .plugin import MerginPlugin
  File "/Applications/QGIS-LTR 2.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Mergin/plugin.py", line 38, in 
    from .configuration_dialog import ConfigurationDialog
  File "/Applications/QGIS-LTR 2.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Mergin/configuration_dialog.py", line 15, in 
    from .utils_auth import (
  File "/Applications/QGIS-LTR 2.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Mergin/utils_auth.py", line 21, in 
    from .mergin.client import MerginClient, ServerType, AuthTokenExpiredError
  File "/Applications/QGIS-LTR 2.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/__init__.py", line 3, in 
    from .client import MerginClient
  File "/Applications/QGIS-LTR 2.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 80, in 
    class MerginClient:
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 276, in MerginClient
    def post(self, path, data=None, headers={}, validate_auth=True, query_params: dict[str, str] = None):
TypeError: 'type' object is not subscriptable


Python version: 3.8.7 (default, Feb 10 2021, 09:04:08) [Clang 12.0.0 (clang-1200.0.32.29)] 
QGIS version: 3.22.10-Białowieża Białowieża, 44701d6dd7 

Conclusion
Created by GitHub Copilot and supervised by a human test analyst.

Metadata

Metadata

Assignees

Labels

blockerRelease can not proceed without this solvedbugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions