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.

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked May 2, 2023 at 10:06
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. 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 Commented May 3, 2023 at 9:51

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.