Spyder

From Wildsong
Revision as of 03:55, 17 May 2017 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

Spyder is an IDE for Python. I learned of it when working for Ceres Imaging.

https://github.com/spyder-ide/spyder

For me there are 4 critical features, which it has:

  • It includes a source level debugger.
  • It is cross-platform.
  • It has code completion.
  • Installing it does not require admin rights on Windows, so I have added it to my toolbox of portable Windows tools.

It's unusual in that it opens an IPython interpreter as its console window so you can just type in random python there. At Ceres we used it like a shell prompt to run code much like running commands.

ArcPy

My initial interest in spyder was to debug code running on Windows using arcpy. That means I have to use a 2.7 kernel.

Does that mean installing arcpy in a different place or getting spyder to use the Python that ESRI installs? There are some options for this in the Anaconda page. You can install a copy of python 2.7 and put a .pth file into it that points at the ESRI arcpy code. This fools it into working.

On the Mac I edited the configuration settings to tell it which Python interpreter to use. In the Mac I have to text edit ~/.spyder/spider.ini and change "Default" to "false" and "executable" to point at the right Python.

Remote debugging

This is something I can do in Komodo, but I have not needed it in some time, so I have not tried it in Spyder yet. Some notes: https://groups.google.com/forum/#!searchin/spyderlib/remote%7Csort:relevance/spyderlib/usljVmI50GI/BdjmwX1k4nAJ

I wonder if I could use a copy on my Mac to debug code running on a Parallels machine.

Mac install note

cd ~/bin
ln -s ../miniconda2/bin/conda
ln -s ../miniconda2/bin/spyder

Instead of trying to trick Spyder into using another Python, I just switched over to using Spyder for GIS and I install modules using "conda install modulename", e.g. "conda install gdal" will install the latest gdal.

You can use virtual environments, this will set one up called "gis" and install all the modules that arcgis and gdal depend upon.

conda create -n gis -c esri arcgis gdal

Now you have to tell spyder that you want it to use that virtualenv environment.