Getting Spyder IDE to work with QGIS?

by owl7   Last Updated July 12, 2018 01:22 AM

I was hoping someone could help me get Spyder working with QGIS. I am finding the python editor limiting within QGIS as I would like to debug my code, use the variable explorer, and be able to run highlighted code. I have tried two routes:


Route 1: Install Spyder within the OSGeo4W QGIS python instance

I installed OSGeo4W Network Installer (64 bit) v3.2 and opened OSGeo4W Shell and typed:

py3-env
python -m pip install spyder
spyder3

But I am getting errors in my IPython console:

SyntaxError: invalid syntax
File "C:\OSGEO4~1\apps\Python36\lib\site.py", line 177
file=sys.stderr)

Also, when I put in

from qgis.core import *
import qgis.utils

into my python script, it complains with unable to detect undefined names

I noticed all the QGIS files are in C:\OSGeo4W64\apps\qgis\


Route 2: Create new conda environment and install QGIS via conda

I used the install instructions at this url: https://anaconda.org/conda-forge/qgis

I create a new conda environment and then typed:

conda install -c conda-forge qgis 
conda install spyder
start spyder

My IPython console is fine (i.e. no errors as route 1), but I get errors when trying to import qgis.core etc into my script as in route 1.

I noticed that conda installed all the QGIS files to C:\Users\<user_name>\AppData\Local\Continuum\miniconda3\envs\<my_env>\Library\


Would anyone have any idea how to get this working?



Related Questions


Working with numba in QGIS

Updated July 30, 2017 04:22 AM


Error while installing QGIS with conda

Updated September 26, 2018 06:22 AM