[QGIS-Developer] Plugin dependency with binaries: 'best' way to guide user to install?

Johannes Kröger (WhereGroup) johannes.kroeger at wheregroup.com
Wed Apr 6 03:12:52 PDT 2022


Trying to find a smart way to install Python dependencies for the users 
that will not potentially not work or even break stuff is a very hard 
thing(tm). Check out these two QEPs for a lot of discussion and possible 
approaches:

https://github.com/qgis/QGIS-Enhancement-Proposals/issues/202
https://github.com/qgis/QGIS-Enhancement-Proposals/issues/179

Cheers, Hannes

Am 06.04.22 um 00:10 schrieb Pedro Camargo via QGIS-Developer:
> Hey Aron,
>                    I did explore that route, but I found out that it 
> would fail when the user did not have administrator rights (or even if 
> QGIS had not been ran as administrator on Windows).  Did you find it 
> to be different?
>
> Cheers,
> Pedro
>
>
>
> ---- On Wed, 06 Apr 2022 03:28:09 +1000 *Aron Gergely 
> <aron.gergely at rasterra.nl>* wrote ----
>
>     Thank you, I checked out your plugin - yes that seems also a good way.
>     I already had the logic to detect, throw message, guide to dialog,
>     etc... implemented similar to yours.
>
>     But I wanted to let pip manage the actual package, so I went with
>     the subprocess+pip route. Here is a minimum working example:
>
>     import subprocess
>     import sys
>
>
>     try:
>          subprocess.check_call((sys.executable, '-m', 'pip', 'install', 'h3<=3.99'))
>     except subprocess.CalledProcessErroras e:
>          raise e# handle any errors here instead
>
>     I connected it to a button in a dialog. And catch stdout, stderr
>     and the exit code of the subprocess so I can show the user what is
>     happening.
>
>     Have not yet tried on other platforms than Linux. But
>     sys.executable is there to solve the ambiguity of python
>     executable path.
>
>
>     Best regards,
>     Aron
>
>
-- 
Johannes Kröger / GIS-Entwickler/-Berater

---------------------------------------------
Schon gewusst?

In unserem Blog geben wir Tipps & Tricks zu Open-Source-GIS-Software
und berichten aus unserem Experten-Alltag:
https://wheregroup.com/blog/
---------------------------------------------

WhereGroup GmbH
Grevenweg 89
20537 Hamburg
Germany

Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

johannes.kroeger at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220406/003ea4ea/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xBF7B268A77C202D5.asc
Type: application/pgp-keys
Size: 2476 bytes
Desc: OpenPGP public key
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220406/003ea4ea/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220406/003ea4ea/attachment-0001.sig>


More information about the QGIS-Developer mailing list