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.gerg...@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.kroe...@wheregroup.com www.wheregroup.com Geschäftsführer: Olaf Knopp, Peter Stamm Amtsgericht Bonn, HRB 9885 -------------------------------
OpenPGP_0xBF7B268A77C202D5.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer