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

nagyrobi_r at yahoo.com nagyrobi_r at yahoo.com
Thu Apr 21 00:04:00 PDT 2022


Thank you Richard for the answer. I'll see what i can cook up. 

Sent from Yahoo Mail on Android 
 
  On Wed, Apr 20, 2022 at 8:11 PM, Richard Duivenvoorde via Qgis-user<qgis-user at lists.osgeo.org> wrote:   Hi,

if you would ask me, I'd advice:
- small (python) modules? Add a copy in your plugin
- others: instruct users to install them (depending on OS this is more or less difficult)

Your methods all need some 'magic' to happen, which will probably break, but feel free to try.

Regards,

Richard Duivenvoorde

On 4/19/22 23:08, nagyrobi_r--- via Qgis-user wrote:
> 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

_______________________________________________
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
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220421/fef12762/attachment.html>


More information about the Qgis-user mailing list