Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install plugin with recent Python versions (>=3.10) #295

Open
hauke96 opened this issue Sep 18, 2023 · 8 comments
Open

Unable to install plugin with recent Python versions (>=3.10) #295

hauke96 opened this issue Sep 18, 2023 · 8 comments

Comments

@hauke96
Copy link

hauke96 commented Sep 18, 2023

When I install the plugin in QGIS 3.32.2 with Python 3.11.5 on Arch Linux, the stack trace (s. below) appears. From my research, the error is here since collections.MutableMapping was moved from collections to collections.abc with Python 3.10.

My personal fix:
I copied the latest protobuf folder from GitHub and used the descriptor_pb2.py from this repo (which is somehow generated?). This means fixing the error is not very urgent for me, but probably annoying for other people 😉

The stack trace:

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

AttributeError: module 'collections' has no attribute 'MutableMapping' 
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/__init__.py", line 25, in classFactory
    from .plugin.vtr_plugin import VtrPlugin
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/plugin/vtr_plugin.py", line 51, in 
    from .vt_reader import VtReader
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/plugin/vt_reader.py", line 33, in 
    from .util.mp_helper import decode_tile_native, decode_tile_python, load_lib, native_decoding_supported, unload_lib
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/plugin/util/mp_helper.py", line 10, in 
    import mapbox_vector_tile
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/mapbox_vector_tile/__init__.py", line 1, in 
    from . import encoder
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/mapbox_vector_tile/encoder.py", line 13, in 
    from .Mapbox import vector_tile_pb2 as vector_tile
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/mapbox_vector_tile/Mapbox/vector_tile_pb2.py", line 6, in 
    from google.protobuf import reflection as _reflection
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/google/protobuf/reflection.py", line 58, in 
    from google.protobuf.internal import python_message as message_impl
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/google/protobuf/internal/python_message.py", line 61, in 
    from google.protobuf.internal import containers
  File "/usr/lib/python3.11/site-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/google/protobuf/internal/containers.py", line 182, in 
    MutableMapping = collections.MutableMapping
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'


Python version: 3.11.5 (main, Sep  2 2023, 14:16:33) [GCC 13.2.1 20230801] 
QGIS version: 3.32.2-Lima Lima, exported 

Python Path:
/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/contour
/usr/share/qgis/python
/home/username/.local/share/QGIS/QGIS3/profiles/default/python
/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python311.zip
/usr/lib/python3.11
/usr/lib/python3.11/lib-dynload
/home/username/.local/lib/python3.11/site-packages
/usr/lib/python3.11/site-packages
/home/username/.local/share/QGIS/QGIS3/profiles/default/python
/home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs
@sangsatori
Copy link

I'm also unable to install the plugin (Flatpak on Fedora 38). Same error.

Python version: 3.10.13 (main, Nov 10 2011, 15:00:00) [GCC 12.2.0]
QGIS version: 3.32.3-Lima Lima, exported

For context, here's the Python changelog entry documenting the move.

@amnesic
Copy link

amnesic commented Nov 3, 2023

The same error is reproducible with my configuration

Qt version 5.15.8
Python version 3.11.6
GDAL/OGR version 3.7.2
Apple M1 Max , MacOS Sonoma 14.1 (23B74)

The stack trace:

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

AttributeError: module 'collections' has no attribute 'MutableMapping' 
Traceback (most recent call last):
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/__init__.py", line 25, in classFactory
    from .plugin.vtr_plugin import VtrPlugin
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/plugin/vtr_plugin.py", line 51, in 
    from .vt_reader import VtReader
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/plugin/vt_reader.py", line 33, in 
    from .util.mp_helper import decode_tile_native, decode_tile_python, load_lib, native_decoding_supported, unload_lib
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/plugin/util/mp_helper.py", line 10, in 
    import mapbox_vector_tile
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/mapbox_vector_tile/__init__.py", line 1, in 
    from . import encoder
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/mapbox_vector_tile/encoder.py", line 13, in 
    from .Mapbox import vector_tile_pb2 as vector_tile
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/mapbox_vector_tile/Mapbox/vector_tile_pb2.py", line 6, in 
    from google.protobuf import reflection as _reflection
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/google/protobuf/reflection.py", line 58, in 
    from google.protobuf.internal import python_message as message_impl
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/google/protobuf/internal/python_message.py", line 61, in 
    from google.protobuf.internal import containers
  File "/Users/username/Applications/QGIS-3.32.app/Contents/MacOS/../share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/vector_tiles_reader/ext-libs/google/protobuf/internal/containers.py", line 182, in 
    MutableMapping = collections.MutableMapping
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'


Python version: 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:39:39) [Clang 15.0.7 ] 
QGIS version: 3.32.3-Lima Lima, exported 


@Clfh47
Copy link

Clfh47 commented Feb 19, 2024

Same issue her, but restricted to latest versions apt-get will offer me (I know nothing about Python).

Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
QGIS version: 3.28.15-Firenze Firenze, 252ad49ddcb
Ubuntu 22.04.3 LTS

Any work-arounds or suggested alternative plug-ins for accessing Ordnance Survey tiles with URLs like
https://api.os.uk/maps/vector/v1/vts?key=***
?

@tomchadwin
Copy link
Contributor

tomchadwin commented Feb 19, 2024

I believe this plugin is now redundant, as QGIS now reads vector tiles natively.

@sfkeller
Copy link

Thanks for your feedback Tom and all:
So you're saying there's a need for such a plugin?
We have a hard time maintaining plugins like this in our spare time, so no promises...

@tomchadwin
Copy link
Contributor

@sfkeller Apologies for the typo in my message: "I believe this plugin is now redundant".

@sfkeller
Copy link

@sfkeller Apologies for the typo in my message: "I believe this plugin is now redundant".

All right. Thanks, Tom. May I take this opportunity to ask: Do you know the best way to mark a deprecated plugin like this, which is published in the repository https://plugins.qgis.org/, as "deprecated" or to delete it completely there?

@tomchadwin
Copy link
Contributor

@sfkeller:

https://github.com/Geolicious/qgis2leaf/blob/master/metadata.txt#L66-L67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants