In Praise of Anaconda

papapishu-Black-snake

Do you want to learn to code?  Of course you do, why wouldn’t you?  Programming is fun, like solving a puzzle.  It helps you think in a computational and pragmatic way about certain problems, allowing you to automate those problems away with a few lines of code.  Choosing to learn programming is the first step on your path, and the second is choosing a language.  These days there are many great languages to choose from, each with their own strengths and weaknesses.  The right language for you depends heavily on what you want to do (as well as what language your coworkers are using).

If you don’t have any coder colleagues and can’t decide on a language, I would suggest taking a look at Python.  It’s mature, battle-tested, and useful for a just about anything.  I work across many different domains (often in the same day) and Python is a powerful tool that helps me take care of business whether I’m processing XML, analyzing data or batch renaming and moving files between systems.  Python was created to be easy to read and aims to have one obvious “right” way to do any given task.  These language design decisions not only make Python an easy language to learn, but an easy language to remember as well.

One of the potential problems with Python is that it might not already be on your computer.  Even if it is on your computer, it’s most likely an older version (the difference between Python v2 and v3 is kind of a big deal). This isn’t necessarily a problem with Python though; you would probably have to install a new interpreter (the program that reads and executes your code) no matter what language you choose. The good news is that there is a very simple (and free!) tool for getting the latest version of Python on your computer regardless of whether you are using Windows, Mac or Linux.  It’s called Anaconda.

Anaconda is a Python distribution, which means that it is Python, just packaged in a special way. This special packaging turns out to make all the difference.  Installing an interpreter is usually not a trivial task; it often requires an administrator password to install (which you probably won’t have on any system other than your personal computer) and it could cause conflicts if an earlier version already exists on the system.  Luckily Anaconda bypasses most of this pain with a unique installer that puts a shiny new Python in your user account (this means you can install it on any system you can log in to, though others on the system wouldn’t be able to use it), completely separate from any pre-existing version of Python.  Learning to take advantage of this installer was a game-changer for me since I can now write and run Python code on any system where I have a user account.  Anaconda allows Python to be my programming Swiss Army knife; versatile, handy and always available.

Another important thing to understand about Anaconda’s packaging is that it comes with a lot of goodies.  Python is famous for having an incredible amount of high-quality tools built in to the language, but Anaconda extends this even further. It comes with Spyder, a graphical text editor that makes writing Python code easier, as well as many packages that extend the langauge’s capabilities. Python’s convenience and raw number crunching power has made it a popular language in the scientific programming community, and a large number of powerful data processing and analysis libraries have been developed by these scientists as a result. You don’t have to be a scientist to take advantage of these libraries, though; the simplicity of Python makes these libraries accessible to anyone with the courage to dive in and try them out.  Anaconda includes the best of these scientific libraries: IPython, NumPy, SciPy, pandas, matplotlib, NLTK, scikit-learn, and many others (I use IPython and pandas pretty frequently, and I’m in the process of learning matplotlib and NLTK).  Some of these libraries are a bit tricky to install and configure with the standard Python interpreter, but Anaconda is set up and ready to use them from the start.  All you have to do is use them.

While we’re on the subject of tricky installations, there are many more packages that Anaconda doesn’t  come with that can be a pain to install as well. Luckily Anaconda comes with its own package manager, conda, which is handy for not only grabbing new packages and installing them effortlessly, but also for upgrading the packages you have to the latest version. Conda even works on the Python interpreter itself, so when a new version of Python comes out you don’t have to reinstall anything.  Just to test it out, I upgraded to the latest version of Python, 3.4.2, while writing this article. I typed in ‘conda update python‘ and had the newest version running in less than 30 seconds.

In summary, Anaconda makes Python even more simple, convenient and powerful.  If you are looking for an easy way to take Python for a test drive, look no further than Anaconda to get Python on your system as fast as possible. Even seasoned Python pros can appreciate the reduced complexity Anaconda offers for installing and maintaining some of Python’s more advanced packages, or putting a Python on systems where you need it but lack security privileges. As an avid Python user who could install Python and all its packages from scratch, I choose to use Anaconda because it streamlines the process to an incredible degree.  If you would like to try it out, just download Anaconda and follow the guide.