9

I'm developing a QGIS plugin and I would like to use arrow or requests packages as I'm used to manipulate dates and REST APIs.

QGIS does not come with these packages (at less arrow), so when I try to access my plugin in QGIS I've got :

"ImportError: No module named arrow"

How can I specify my requirements?

6
  • 3
    package the egg of the modules with the plugin... or intercept the error and notify the user to install the missing packages Commented Dec 23, 2015 at 16:52
  • R has packages, Python has modules and if you use a Windows version, they are difficult to install (particularly with the standalone QGIS version, see How to install 3rd party python libraries for QGIS on Windows?)
    – gene
    Commented Dec 23, 2015 at 17:54
  • 2
    In Boundless plugis you can find a way to package module in the same plugin. e.g. read this code github.com/boundlessgeo/qgis-geoserver-plugin Commented Dec 24, 2015 at 8:57
  • @gene python has packages and modules - stackoverflow.com/questions/7948494/…
    – user2856
    Commented Dec 24, 2015 at 11:09
  • 1
    @LuigiPirelli if you find the time, it would be great if you could summarize the necessary steps to package a module in a plugin in an answer to this question. Thanks a lot!
    – underdark
    Commented Dec 25, 2015 at 22:00

1 Answer 1

3

Thanks for the resources. I tried to use paver but it seems to be a bit painful to implement, for a non-expert developer, no?

Furthermore, by default, pip is not installed even with the OSGeo4W installer. Could you paver script works without it?

To install it, I followed these instructions and I produced a batch file (see below) but doesn't solve the admin rights problems:

@echo off
Title "PyPi in QGIS"
Echo "Adding 3rd party modules in QGIS"

REM securely download get-pip install script
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

REM install pip
python get-pip.py

REM install 3rd party modules
pip install --user arrow
pip install --user requests
pip install --user requests[security]

@echo on
pause
1
  • 2
    To install into user python directory (no admin rights needed) you can add --user switch into your command: pip install --user arrow and etc. Commented Jun 6, 2017 at 7:31

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.