TransWikia.com

Plugin development for QGIS 3.16 (Windows): how to handle dependencies on external packages?

Geographic Information Systems Asked by Laure Ravier on May 12, 2021

I’ve been working on a plugin for use with QGIS 3.16. I have developed it locally and I want to now deploy it so others can use it. The problem or rather question I’m having is: How do I deal with dependencies on external packages?

I found this answer:
Development of a plugin which depends on an external Python library

and this discussion:
http://osgeo-org.1560.x6.nabble.com/A-pipinstall-plugin-is-possible-First-What-s-the-difference-between-the-Osgeo4w-Shell-td5107633.html

But I’m wondering how people handle this right now.
I’m pretty new to Python and QGIS both so maybe my concerns just stem from not being informed. Some of the packages I had to install are a little tricky to get working on Windows (geopandas for example), which is the first part I’m not sure how to handle. I’ve read that installing with conda seems to work reliably, but that doesn’t seem to be a viable option since I have no idea whether a user will have conda installed (or am I missing something here?).

I’m basically looking for some documentation/recommendations to handle dependencies semi-gracefully. I would like to avoid changing the users setup if possible, since my plugin might need a different version of some package and another plugin might require a different version. Any tips/good reads on how to go about this?

Is it possible to have the plugin in its own virtual environment for example? Or can I somehow download the necessary packages and include them from a file? For geopandas, that would probably mean also downloading its dependencies, can I then force geopandas to use those versions of packages instead of what might be on the users path? Would you recommend such an approach?

I’m working on Windows by the way, and the plugin does not have to be cross-platform at least for now.

I realize this is a pretty broad question, but I’m hoping to get some tips on where to start looking for a solution.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP