[Qgis-user] Adding python package dependencies to a QGIS plugin

Johannes Kröger (WhereGroup) johannes.kroeger at wheregroup.com
Thu Apr 21 04:23:02 PDT 2022


Hey Robert :)

tl;dr: Check this out -> 
https://lists.osgeo.org/pipermail/qgis-developer/2022-April/064661.html

This question has been asked many times but because mailing lists are 
... special ... the discussions around it are spread across tens of 
messages, accessible via arcane and hard-to-navigate websites that might 
not even be indexed nicely by search engines.

Anyways, just some days ago this was discussed once again on the 
qgis-developer list: 
https://lists.osgeo.org/pipermail/qgis-developer/2022-April/064661.html

In this case you are lucky that the discussion has not gone into another 
month yet so you should be able to click on "Next message (by thread)" 
to see the discussion bit-by-bit. I'd recommend checking the threaded 
view too though 
https://lists.osgeo.org/pipermail/qgis-developer/2022-April/thread.html 
because someone might have decided to branch off into another thread 
with a different mail subject.

If you want to reply, you cannot use your account on the qgis-user 
mailing list but have to register once again.

No, I don't like mailing lists, thanks for asking! >:( ;)

Cheers, Hannes


Am 19.04.22 um 23:08 schrieb nagyrobi_r--- via Qgis-user:
> Hei everybody!
>
> I am trying to develop a QGIS plugin, and the plugin requires python 
> modules that are not present in the basic QGIS python install. Since i 
> want these packages to install for users that might wish to use the 
> plugin, what method would be the correct one to install the 
> dependencies? I am thinking that some users might have multiple python 
> installs at once, multiple pythonpaths etc.
>
> 1. Method using setup.py when installing the module. But how would 
> that run? or when would it run? Very open for suggestions here.
> 2. Using subprocess with a try and except clause: prone for errors, 
> since any python instance might be called :
>     import sys
>     import subprocess
>
>     # implement pip as a subprocess:
>     subprocess.check_call(['python', '-m', 'pip', 'install',
>     '<packagename>'])
> 3. Using pip.main, which seems to warn about a deprecation 
> possibilities for the future
> import pip
> pip.main(['install', package])
>
> Method 1 could run one time at the plugin install, whilst methods 2 
> and 3 would run at every plugin load.
> How do you go about adding dependencies to your package?
>
> Kind regards,
> Robert Nagy
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
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-user/attachments/20220421/967e0b86/attachment.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-user/attachments/20220421/967e0b86/attachment.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-user/attachments/20220421/967e0b86/attachment.sig>


More information about the Qgis-user mailing list