Spyder: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
Line 33: Line 33:


Compared with Windows this is starting to seem difficult! I ran through several attempts before deriving the following.
Compared with Windows this is starting to seem difficult! I ran through several attempts before deriving the following.
=== Anaconda ===
[[Anaconda]] is a life changing decision not a software package. I am going to try it out now. 5-12-17
=== Alternatively, Spyder WITHOUT Anaoconda ===


I could not find a combination of brew and pip commands that would give me a working spyder.
I could not find a combination of brew and pip commands that would give me a working spyder.


With Windows I found [https://conda.io/miniconda.html miniconda] worked, trying it on the Mac. The full "Anaconda" package is big and all I want is spyder!
With Windows I found [https://conda.io/miniconda.html miniconda] worked, trying it on the Mac. The full "Anaconda" package is big and all I want is spyder!  
I grabbed the 2.7 python version, I like python 3 but most of the GIS stuff around seems to prefer 2.7.
I grabbed the 2.7 python version, I like python 3 but most of the GIS stuff around seems to prefer 2.7.
At least in the ESRI world.
At least in the ESRI world.
Line 56: Line 62:
You can tell it worked by looking at the console in spyder (lower right). It should NOT say "Continuum" next to Python 2.7.13
You can tell it worked by looking at the console in spyder (lower right). It should NOT say "Continuum" next to Python 2.7.13


I think I sort of have it working, now I have to learn more about Spyder itself. That would be elsewhere in this page.
I think I sort of have it working, now I have to learn more about Spyder itself.

Revision as of 17:07, 13 May 2017

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 three 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 can use it everywhere.

It's unusual in that it opens an IPython interpreter as its console window so you can just type in random python there.

ArcGIS

My primary interest is 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?

I think it's the same as in the Mac -- edit 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. Maybe the preferences editor works in Windows?? It won't let me pick /usr/local/bin/python on the Mac, it ignores the change.

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

Compared with Windows this is starting to seem difficult! I ran through several attempts before deriving the following.

Anaconda

Anaconda is a life changing decision not a software package. I am going to try it out now. 5-12-17

Alternatively, Spyder WITHOUT Anaoconda

I could not find a combination of brew and pip commands that would give me a working spyder.

With Windows I found miniconda worked, trying it on the Mac. The full "Anaconda" package is big and all I want is spyder! I grabbed the 2.7 python version, I like python 3 but most of the GIS stuff around seems to prefer 2.7. At least in the ESRI world.

So download the shell script, run it, installing miniconda in your home directory. Change your path. Then you can run "conda install spyder".

This installs (yet another) Python environment. I do NOT put ~/miniconda2/bin into my system PATH. Instead I create symlinks as needed from ~/bin

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

Since I have ~/bin on my path already this works. I can launch spyder 3 now. In spyder I can set the python executable. The default is "/Users/bwilson/miniconda2/bin/python". The "preferences" did not WORK. I had to edit ~/.spyder/spyder.ini directly and I set "executable" = "/usr/local/bin/python" and "Default=false".

You can tell it worked by looking at the console in spyder (lower right). It should NOT say "Continuum" next to Python 2.7.13

I think I sort of have it working, now I have to learn more about Spyder itself.