23

I've built a python application that has its own GUI. I am trying to use qgis.core/PyQGIS as map display only. Specifically, I have anaconda 2.3 and its python distribution (2.7.11).

After research on postings on this thread, it seems that this scheme can only work if the application I am building (or anyone else' application) would need to "live inside QGIS world", i.e. move all dependencies to QGIS' python distribution. Could somebody (preferably from QGIS team) to give a definitive answer to this.

  • You could just add the qgis site packages into your code with sys. sys.path.append("path\to\site-lib") – geodranic Jun 11 '18 at 18:02
  • This is just an idea, since I have been struggling with this problem myself, but suppose you compile your program into an executable using pyinstaller, doesn't that eliminate the problem of python dependency? Whether you are using some stuff from anaconda and some stuff from qgis, pyinstaller digs through everything and handles the modules itself ,,, the application you package doesn't really care what environment you initially developed everything in... – user32882 Nov 27 '18 at 20:18
1

You can add QGIS's python distribution to your project in Pycharm. Here are detailed steps on this url.

https://github.com/apulverizer/pyspatialopt/wiki/Using-PyQGIS-with-PyCharm

This way, you can add qgis's python distribution and then use them in your native application, maybe just map part.

This answer/example is implementable with PyCharm project only, please elaborate more about your python environemnt.

0

QGIS 2.x was published with its own version of python(2.7). Any sort of connection from other python distributions is possible but is not recommended.

The easiest way for you is using QGIS's own python. Then simply install your demanded dependencies on it and you will be ready to go.

In the case of using R syntax in your code, just read this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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