0

I've seen few articles around the internet but nothing straightforward/clear regarding this issue. I am planning to create a plugin that will require installing several Python libraries but I do NOT want to install such libraries in the OS Python which seems to be the case for QGIS in MacOS.

Is there a way/trick to get QGIS to create a virtual environment from a requirements.txt, activate the environment and set pythonpath for that environment during the plugin installation process?

I can potentially do such thing manually, but I am looking for an automated option. I've also seen this article, but it's a very hacky solution and could see lots of potential issues popping up. The plugin I plan to create will be used across the company and most users won't know Python or Python troubleshooting. The idea is that they only have to click 'install' to get the plugin working on QGIS.

3
  • Common question, no easy answer... If you are distributing as a zip or internal plugin url, you could package all the dependencies into your plugin.
    – user2856
    Commented May 3, 2023 at 3:56
  • Thanks for the reply. I read the lengthy open issue couple of days ago. It makes me think that the intention behind the creation of QGIS plugins has been to automate methods that already exist in QGIS rather than bringing new capabilities to QGIS. If QGIS could allow the use of virtual environments per plugin, that would be a real game changer in my opinion. Commented May 3, 2023 at 8:22
  • Another option I used a while ago was to build a QGIS + required libraries conda environment using the conda-forge channel. And indeed there is a new QGIS Enhancement Proposal to build the MacOS QGIS installer from the conda-forge channel
    – user2856
    Commented May 3, 2023 at 9:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.