OpenICGC / QgisPlugin

Open ICGC QGIS Plugin for accessing Open Data published by the ICGC (Catalan Mapping Agency).
GNU General Public License v2.0
5 stars 1 forks source link

Cannot install the plugin on QGIS 3.24.3-Tisler #7

Closed jmon12 closed 2 years ago

jmon12 commented 2 years ago

Problem

Trying to install the plugin in the standard way from the "Manage and install plugins" menu of QGIS, I receive the following error: Plugin installation failed: The specified configuration cannot be used.. The console doesn't say more.

I'm new to QGIS and I'm not able to get more verbose information after having looked into the documentation, I would be glad to give you more info if you guide me a little bit. See versioning information below.

Note

There seems to be a versioning mismatch between this git repository and the plugin repository of QGIS:

Versioning

jmon12 commented 2 years ago

I just found the version history of the plugin and everything seems to match. Forget about my note.

jmon12 commented 2 years ago

I could finally install the version 1.1.6 from ZIP using the corresponding dialog in QGIS. Note that I did the following manipulations from the .zip downloaded from that repository:

  1. Unzip the file
  2. Manually run pyrcc5 -o resources_rc.py resources.qrc where necessary since there is no CMake/Qmake file.
  3. Rename the folder QgisPlugin or whatever without the version number.
  4. Compress using zip -r QgisPlugin.zip QgisPlugin.

    Note that the naming (points 3. and 4.) is important. It seems to be related with the way QGIS loads the modules: having the version number at the end as -x.x.x for the directory name (not the name of the zip file) leads to the following error (using QgisPlugin-1.1.6):

    
    Couldn't load plugin 'QgisPlugin-1.1.6' 

ModuleNotFoundError: No module named 'QgisPlugin-1' Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/qgis/utils.py", line 401, in loadPlugin import(packageName) File "/usr/lib/python3.10/site-packages/qgis/utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'QgisPlugin-1'



So my conclusion is that it is a **packaging issue**, either:
 - The `.qrc` resources are not built
 - The "archive naming" issue
icgcaadell commented 2 years ago

Hello, thanks for reporting the problem.

I've tried installing the plugin on Win10 with QGIS QGIS v3.24.3 and on Ubuntu18 with QGGIS v3.16 from the qgis store and it seems to work.

I'm updating my Ubuntu to install a QGIS v3.24 and it does more tests...

Can you try to install the plugin from a release zip (with compiled resources)? from:

icgcaadell commented 2 years ago

In the QGIS documentation on how to publish a plugin, they explicitly request not to publish compiled resource files (section 16.4.2. Code and help): https://docs.qgis.org/3.22/en/docs/pyqgis_developer_cookbook/plugins/releasing.html

Anyway, if you want to compile the plugin resources from source code, you should be aware that we use more than one resource file (one for the plugin and three more for different dialogs)

\resources.qrc \qlib3\base\resources.qrc \qlib3\geofinderdialog\resources.qrc \qlib3\photosearchselectiondialog\resources.qrc Currently we compile the resources interactively under Windows, we will consider adding some script or makefile to compile them in other environments. The name you give the plugin folder should be irrelevant and any name should work for you. I have done the test with the name it gives when downloading directly from GitHub: "QgisPlugin-master" and it has also worked. Release zips use the folder name "OpenICGC" (even though the zip name has the version number). I have not tried to put a dot in the name of the folder, I have no doubt that it can fail... I hope it helps
jmon12 commented 2 years ago

Thank you for your quick answer and tests. Retrying:

Yes I'm aware that there are 4 resources and I compiled all of them manually, or I wouldn't have succeeded when installing from ZIP.

Concerning the directory name in the ZIP archive, dots are indeed probably the issue. The default name I get downloading from the releases is QgisPlugin-1.1.6.zip, and the name of the directory inside the archive has the same name. That's not the case when it is downloaded from the QGIS plugin page: the file is called OpenICGC-1.1.6.zip but the folder in the archive is called OpenICGC.

For the resources and compiled resource files, note that it seems that you're doing the opposite of the QGIS guidelines. In the ZIP downloaded from the QGIS plugin page, I find the following files:

Hope theses details can help. Don't hesitate to come back to me if you do further tests and I can help.

icgcaadell commented 2 years ago

Well, I'm glad it's finally working out for you.

You're right, I had a compiled resource file left in the git source code, I've already deleted it, thanks.

I have looked at the code repository of different plugins published in the qgis store and it seems that there are differences in criteria, some leave the compiled resources on github and others do not...

As I understand (perhaps wrongly):

That's why in github releases I leave a zip with compiled resources (and a correct folder name without development files) and github generates another zip (automatically) with the non-compiled resources (and with a problematic folder name that includes the tag of version)

What do you think?

jmon12 commented 2 years ago

Your analysis of the situation makes sense, and the QGIS guidelines for that matter are quite imprecise.

Thank you for following up!