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

Pedro Camargo c at margo.co
Wed Apr 6 15:34:01 PDT 2022


Hey Aron,

                  This does look/feel like one of those "Been there. Done that. It's hard..." type of things.



VERY interesting proposal, @Hannes. Both would be awesome features if they ever came to fruition!



Cheers,

Pedro




---- On Wed, 06 Apr 2022 22:01:15 +1000 Aron Gergely <aron.gergely at rasterra.nl> wrote ----



@Pedro:
 Tried it today on Windows w OSGeo QGIS and failed right away. But
      in a different way:
 
 If I launch OSGeo QGIS and ask for the python executable's path
      (sys.executabe), I get 'C:/OSGeo4W/bin/qgis-bin.exe'. which looks
      like entry point is for QGIS.  So subprocess calls that and a new
      QGIS window opens.
 
 Not feeling like tackling this and probably other cases.
 So back to download+including those bins I reckon.
 
 @Johannes:
 Thank you. Yes realizing that now..
 
 
 Cheers,
 Aron
 
 
 

On 06-04-2022 12:12, Johannes Kröger
      (WhereGroup) wrote:

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 mailto: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.CalledProcessError as 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

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



-- 
 Kind Regards,
 
 Aron Gergely
 +31 (0) 6 38 70 97 66
 
 Rasterra | http://www.rasterra.nl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220407/08944fa4/attachment.html>


More information about the QGIS-Developer mailing list