9

I developed a plugin for Qgis which depends on some Python packages. On Linux and Mac, this is not really a problem because I can easily install them with the system pip command. Windows is another story because Qgis bundles its own Python installation.

I want to distribute this plugin across the rest of our company, with minimum effort. I thought about setting up our own Qgis plugin repository, so my coworkers also get automatic updates.

But is there some automatic way to install some extra python packages in the Qgis python installation?

4
  • Which packages do you need?
    – Nathan W
    Commented Dec 12, 2013 at 10:49
  • SQLAlchemy, Geoalchemy2 and unidecode. The plugin started out as a standalone command line application. So that's why I need SQLAlchemy. Commented Dec 12, 2013 at 11:21
  • 1
    That's cool. I'm just wondering for if you could bundle them with your plugin. I'm looking into how we can resolve this issue on windows, we really need to include pip and easy_install
    – Nathan W
    Commented Dec 12, 2013 at 11:31
  • Oh well, I guess I should install them by hand for now. Thanks anyway (and for QGis 2.0, it's really awesome)! Commented Dec 12, 2013 at 12:59

2 Answers 2

2

There should be OSGeo4W Shell installation in your Windows system. Run it as administrator and use pip install package. If you dont have pip installed, first download it from: https://bootstrap.pypa.io/get-pip.py Then run python get-pip.py

Now you should be able to install and use new python libs from QGIS.

This works fine in my Windows 8.1

1
  • Is there a more comfortable way to do that 2022? What do you think on automatizing that from inside the plugin using pip like proposed here?
    – geraldo
    Commented Jul 21, 2022 at 16:38
2

I had a similar issue since I also developed a plugin for my company which has to be portable. Since it also relies on other modules I just included them in my plugin directory and then just imported them where necessary. The only thing that I had to do to make it work was to add some empty __init__.py files to some folders of the plugins in order to make python recognize them as modules.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.