1

I'm trying to install a version of the QGIS API that is compatible with the python application I'm developing in Anaconda 2 (Python version 2.7). When I install qgis using conda, it indicates that the QGIS API is only compatible with Python 3. I realize that I eventually need to convert my code to Python 3, but I'm looking for a short term fix. Is it possible to install a version of the QGIS API via conda that is compatible with Python 2.7? When I use the command conda install -c conda-forge qgis=2.18.22 or similar it doesn't find anything.

thanks. Jack Andrewson

4

There is no way to use QGIS3 API with a python 2.7 installation. QGIS3 is built on QT5 as well as Python 3. Installing the old QGIS2.x version would be a solution to your problem but it is strongly discouraged to use those versions. I would recommend upgrading to Python 3.

2
  • Thank you very much for the advice - I went ahead and converted everything to Python 3. Unfortunately, after installing Anaconda 3 (Python3) and the QGIS API via "conda install -c conda-forge qgis" , it throws an error when I try to import via "from qgis.core import *" in my python code. Is it possible to invoke the QGIS API from Anaconda (instead of OSGEO as most examples assume)? I'm trying to do this because most of my Python tools are accessible from Anaconda. Thanks for the help! – Jack Andrewson Apr 27 '20 at 15:55
  • My experience with the QGIS python API is that you have to do a load of manual path-setting to get the C++ based python framework to work properly (see the batch files in a OSGeo4W64 installation). Unfortunately I have no experience with hooking up this environment to anaconda. – root676 Apr 27 '20 at 19:46

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.