After using Spyder for a couple of years, I recently changed my Python IDE from Spyder to PyCharm Community Edition (CE). And since I’ve now used both, I thought I’d share my impressions of each with you.
I had been using Spyder for a couple of years, with very few issues. Spyder is an open source project that runs on MacOS, Windows and Linux and was originally developed by Frenchman Pierre Raybaut, although now jointly maintained by the Spyder Development Team. It was recommended to me by a friend who does a fair bit of scientific and image processing as part of his job. It combines many features you would expect in a good IDE, including:
- A clear interface that both beginners and advanced users will have no problem navigating around:
- A choice of Python or iPython consoles. iPython (with the numbered prompts) is a very powerful REPL editor whose features go way beyond those of the standard Python console. It has now evolved into Jupyter Notebooks.
- NumPy, SciPy, Matplotlib and QT are integrated as standard. No importing. This is particularly useful if you are using Windows, with its several cumbersome ways of importing Python modules. (OK, I’ll admit it: compared to OS/X and Linux, importing Python modules on Windows is excruciating.) On Windows, you’re ready to go as soon as you install Spyder, at least with these packages anyway.
- Good Python and QT documentation.
- A nice selection of alternative coding colour schemes.
- Predictive typing in the code editor, activated with the tab key.
- A reasonably well-featured debugger, with the ability to set hard and conditional breakpoints for stepping through the code in debug mode.
- An excellent n-dimensional Numpy array visualiser in the debugger:
- Configurable run settings, including the ability to execute in either of the Python consoles or a terminal window, change the working directory, or set flags to simulate a command line launch.
- Clear highlighting of all instances of any variable you click on.
I was also aware of a few drawbacks, which were mildly annoying, but not showstoppers:
- It was slow to fire up on every platform I tried it on.
- I had found the initial OS/X version to be a bit flaky on my Mac desktop, crashing regularly. This was probably just the version I installed, and the problems went away when I chose a different dmg file. The first version I ran on my Windows 10 laptop was more stable.
- The version of Python is fixed as part of the version of Spyder you install. If you want to test your code on Python 2.7, Python 3.4 and 3.5, you will have to download and install three different versions of Spyder. It’s not an option you can simply change inside Spyder.
- As you may have realised, the Python you are running in Spyder is not the same Python you have installed on your system. It’s inside the Spyder environment. This can (and did) get confusing when I first started coding.
But apart from these minor issues, and not knowing what else was available, I was pretty happy with it.
In some ways, comparing Spyder and PyCharm CE is an unfair comparison. Both are free, but while Spyder is the result of a purely open source collaboration with a scientific-engineering bias, PyCharm CE is an open source offshoot of a commercial product developed by the Czech company JetBrains. Despite the obvious scientific merits of Spyder, comparing its interface to even the Community Edition of PyCharm feels like comparing the technology levels of the original 1960s Star Trek to that of 1990s Voyager: Spyder is a solid, stable scientific IDE platform, and it does what it says on the lid, but the feature set of PyCharm CE’s interface is a quantum leap ahead.
Here is a short list of the great things I’ve found so far. As far as I can tell, PyCharm CE does almost everything Spyder does, with the following differences:
- It uses the Python interpreters already installed on your system.
- You can change the Python interpreter you want to run on your code with the tick of a box. No need to install a new version of PyCharm.
- The ability to refactor (rename) a variable throughout your code, without using a global find and replace.
- A fast variable order flipper for your equations.
- Alternative syntax suggestions.
- Best practice PEP8 syntax suggestions, if turned on, but it can tend to nag a bit.
- The ability to run the Python conversion program 2to3 within the terminal window, displaying the updated Python 3 code automatically in your current editor window. Very cool.
- Code folding, to hide the inner workings of functions and blocks of code you are not currently working on. Once you get used to using this, it’s hard to go back to Spyder.
- Dozens of keyboard shortcuts.
- Fast, concurrent context switching between the isolated Python console, debugger and terminal outputs. In the Spyder debugger, these are all interleaved into one continuous output.
- A fully integrated Git repository for version control and team collaboration.
- Integrated ability to export to GitHub.
- The ability to run each project in a virtual environment sandbox. This is incredibly useful, if you are doing repeated fast development of multiple projects, or maintaining old code and feel the need to recreate an old module environment, minus all the crap you’re installed since.
- An easily accessible list of the packages you have installed for each project VirtualEnv sandbox.
- New packages are simply installed at the integrated terminal using pip, at least on Linux and Mac. Not so straightforward on a Windows system.
- Support for web development using the Django, web2py and Flask frameworks available via upgrades to the full product.
- A presentation demo mode giving code zooming, to display your code for others to see in meetings and teaching environments. Quite useful, even when you’re just coding with friends.
Here’s a typical screenshot of the PyCharm dashboard from one of my recent projects:
Here you can see some features of the PyCharm CE debugger:
- While stepping through your code, any variables modified by your code are shown beside the line of code.
- A Data View gives an elementary visual representation of the elements values in Numpy arrays.
- A variables window to capture the values of all known variables at an Execution Point.
- Tabs in the bottom left window to switch between separated Debug, Console or Terminal windows.
- It’s difficult to see all the instances of any variable you click on, in some colour schemes.
- PyCharm CE’s debugger doesn’t do much with N-dimensional Numpy arrays, which Spyder excels at. The Numpy array visualiser in PyCharm CE is a bit basic. In PyCharm’s defence, PyCharm CE is a free, open source version of their full commercial product, which has extensive Numpy visualisation features.
- The File/Open Recent menu only offers a choice of recent projects, not individual Python programs you may have loaded.
Just as with Spyder there is no steep learning curve to get past, and you will be coding from day one. On that subject, it’s a good idea to leave the PyCharm CE Startup Tips on, as they are a nice way of discovering obscure but useful features you may not otherwise discover. The current release of PyCharm Community Edition is also very stable, and has not crashed or frozen once since I installed it on my Mac.
If you’re just starting out with Python, both IDE’s are easy to use.
Spyder is a solid IDE with a number of very useful standard features. It’s also a powerful platform for scientific and mathematical programming. If that’s the core of what you will be doing, then you will find the integrated Numpy, Matplotlib and QT packages in Spyder very handy, and the Numpy array visualisation features in the debugger absolutely essential.
If you’re not a heavy Numpy N-dimensional array coder, then PyCharm CE is probably the better way to go. This choice becomes easier if you’re maintaining multiple projects, each with its own Python package and module environments, or if you are working in a collaborative environment that needs an integrated version control system. There’s nothing stopping you using Git and VirtualEnv manually with Spyder, but with PyCharm CE, they’re already under the hood.
There is a lot I haven’t even mentioned, such as how well each IDE platform integrates the various UI widget tools (such as Spyder’s Matplotlib, PyCharm’s Swing and Spyder’s QT), and these have not been covered.
For Python novices: if you’re already running Windows, I would recommend Spyder, as there’s more useful Python stuff included in the Anaconda distribution of Spyder. If you are about to upgrade your hardware and you feel strongly about going with PyCharm CE, then I recommend going with a Mac or Linux system. Why? Because compared to the relatively simply Python package installation tools available on Mac and Linux, navigating the various Python package installation tricks and workarounds on Windows will probably reduce you to tears of frustration.
Spyder WinPython 64-bit running Python 3.4.4 with PyQt5 5.5.1 on Windows 10
Spyder 2.3.8 on Mac OS/X (Darwin). Contains 64bit Python 3.5.0, Qt 4.8.7, PyQt4 (API v2) 4.11.4
PyCharm Community Edition 2017.2.3 running on Mac OS/X 10.10.5.
PyCharm Community Edition 2017.2.3 running on Windows 10.
8 Replies to “IDE Comparison: Spyder vs. PyCharm CE”
Interesting post. Obviously hard to hit two moving targets, but a valuable exercise.
Thanks, Shug. Glad to help.
I am often to blogging and i really admire your content. The article has really peaks my interest. I am going to bookmark your site and preserve checking for brand new information.
Happy to hear you found it interesting.
very interesting points you have mentioned, thanks for putting up.
No worries, Geri. Glad you found it useful.
Informative and nicely written. Thanks a lot!
Like!! Really appreciate you sharing this blog post.Really thank you! Keep writing.