[QGIS-Developer] QGIS plugin depends on pypi package

John Lindsay jlindsay at uoguelph.ca
Thu Feb 8 15:45:34 PST 2024


Hello,

I believe that I've solved my earlier issue with my QGIS plugin, which previously relied on a pip package. In order to avoid this dependency, I decided to include the Whitebox Workflows wheel in with my plugin. Unfortunately, however, this has increased the size of my plugin fairly substantially. The issue is that I need to included a wheel for each of the four supported operating systems and each are about 10MB. My plugin zip file is now a little less than 40MB. When I try to upload the new version to the QGIS plugin repo it is telling me that the file is too large. Does anyone know what the maximum size of a plugin zip file is? Thanks.

Regards,

John



Prof. John Lindsay

Dept. of Geography, Environment & Geomatics,

The University of Guelph,

Room 122, Hutt Building,

E-mail: jlindsay at uoguelph.ca

Phone: (519) 824-4120 ext. 56074

Web: https://geg.uoguelph.ca/faculty/lindsay-john

Research page: https://jblindsay.github.io/ghrg/index.html

WhiteboxTools GIS project: https://www.whiteboxgeo.com/

Twitter: https://twitter.com/whiteboxgeo

________________________________
From: QGIS-Developer <qgis-developer-bounces at lists.osgeo.org> on behalf of John Lindsay via QGIS-Developer <qgis-developer at lists.osgeo.org>
Sent: Friday, January 19, 2024 10:00 AM
To: qgis-developer at lists.osgeo.org <qgis-developer at lists.osgeo.org>
Subject: [QGIS-Developer] QGIS plugin depends on pypi package

Hello everyone,

I am developing a new QGIS plugin (https://plugins.qgis.org/plugins/whitebox_workflows_for_qgis/#plugin-manage) that serves as a frontend for a Python geospatial analysis library called Whitebox Workflows for Python (WbW). The plugin seems to work well with on major exception, it requires that the user have WbW installed. It can be installed quite easily using pip (pip install whitebox-workflows), however, I know that QGIS uses its own localized version of Python, which seems to lack a terminal app access (at least on MacOS). Besides, a better solution would be for the plugin to install this package via pip when it is itself first installed and launched. I tried to accomplish this with the following code:

https://github.com/jblindsay/whitebox_workflows_for_qgis/blob/4e463262f6cfd1987afa2f3f7e0e79656eb8d27e/whitebox_workflows_for_qgis_provider.py#L56

This code, which runs whenever the plugin is launched, first checks to see if whitebox_workflows can be imported and if not, it runs pip from the Python script to install it. Unfortunately, some users have reported issues with this not working correctly:

https://github.com/jblindsay/whitebox_workflows_for_qgis/issues/1

[https://opengraph.githubassets.com/a248a1a51b43baa531f4fdf47f85868a01c5785c3dded22234ce269d2c64c9e4/jblindsay/whitebox_workflows_for_qgis/issues/1]<https://github.com/jblindsay/whitebox_workflows_for_qgis/issues/1>
Installation in QGis fails · Issue #1 · jblindsay/whitebox_workflows_for_qgis<https://github.com/jblindsay/whitebox_workflows_for_qgis/issues/1>
AttributeError: 'NoneType' object has no attribute 'write' Traceback (most recent call last): File "C:\\Users/thomas.struller/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\whitebox_work...
github.com

So now I'm left trying to figure out what the recommended approach to installing QGIS plugin dependencies is. Any advice from anyone that has successfully dealt with this problem previously? Thanks.

Regards,

John Lindsay



Prof. John Lindsay

Dept. of Geography, Environment & Geomatics,

The University of Guelph,

Room 122, Hutt Building,

E-mail: jlindsay at uoguelph.ca

Phone: (519) 824-4120 ext. 56074

Web: https://geg.uoguelph.ca/faculty/lindsay-john

Research page: https://jblindsay.github.io/ghrg/index.html

WhiteboxTools GIS project: https://www.whiteboxgeo.com/

Twitter: https://twitter.com/whiteboxgeo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240208/627278a0/attachment-0001.htm>


More information about the QGIS-Developer mailing list