Python on Windows causing you pain? Try Anaconda

My last post on Python with Windows got almost 5000 views in a day, and hundreds of comments on Reddit, and 22+ on my own. The most common comment was You Loser, can’t even install Python? You’re pathetic. The second most common comment was I faced the exact same problem, and decided to move away from Windows (& in some cases, Python itself).

This makes me sad.  Clearly there is a problem. Worse than that, there is macho posturing and rudeness which is completely unhelpful to beginners.

The most interesting comment I got was from Sebastian, the runs the the DashingD3.js tutorial website:

“I teach live D3.js workshops where we use Python on the command line for running the simplest web server possible. EVERY SINGLE TIME – there are one to two people who have a windows computer instead of mac / linux / unix based computer. EVERY SINGLE TIME – this person falls behind because they have to spend somewhere between 10-60 minutes installing python on WIndows, getting python on their PATH, being able to run “python -m SimpleHTTPServer” on their command line”

Sebastian’s experience isn’t even that unique. If you teach Python, or regularly have to deal with beginners, you will see this problem again and again. Which is why I’ve trying to find solutions, and that’s what led me to Anaconda.

Anaconda: Why it’s useful

If you have struggled with Python on Windows, you might want to look at Anaconda. The advantages it has are:

  1. Installs in one place only, no spreading Python libraries all over the place (I’m looking at you, Activestate). That means it’s easy to upgrade/remove. And it automatically adds itself to the path on Windows, solving a big pain for beginners.

  2. Comes with most libraries you may need installed. This includes libraries like numpy, scipy which normally have to be compiled.

3.  It comes with a fairly good packaging manager, Conda, as well as Pip.

Always use the package manager to install libraries. Try not to download and install them from online sources, as they might not be easy to remove. Especially on Windows, where nothing  is ever uninstalled and lives like a ghost in the registry.

  1. It allows you to create isolated environments. (But not really. see below)

Anaconda: Where it doesn’t work

NOTE: This section is obsolete as of 2016. Conda envs now work like a charm. The packages like OpenCV are mainly for Linux, which is why they didnt install. But that’s another whole discussion.

But not everything is perfect with Anaconda. I found 2 big problems:

  1. While you can create environments, activating them doesnt work, at least on Windows. I had to actually go into the directory to use the environment I created(which sort of beats the whole purpose). Now, this might be a problem with the Windows path variable, but it still reflects badly on Anaconda. I’d stick to VirtualEnv for now. (The problem with VirtualEnv is that it only allows you to create Python environments, while Conda environments are more flexible, ie, you can have non-Python libraries as well).

  2. Anaconda allows you to add new packages(ones they don’t support) via an extenal service (binstar.org). When I tried to install OpenCv from it, however, it didn’t work, even though I tried to download from 3-4 different repositories. Again, it might be a problem of the people who uploaded them, but still. Since they market this feature on their website, they must also ensure it works.

In spite of these failures, I would still recommend Anaconda, as it’s miles better than anything out there. If you are on Windows, nothing beats Anaconda if you want a hassle free Python experience.

6 thoughts on “Python on Windows causing you pain? Try Anaconda”

  1. Thanks for your comments and feedback.

    I’m curious, though, about your statement that environments don’t work. What does that mean? What did you try? Which shell are you using (the standard cmd.exe shell?)

    There is a command “activate” that will activate your environment. If you have an environment named “test”, then the command “activate test” will make that your default environment. If you find a bug, the open source project conda would love to receive your bug-report.

    1. I use Powershell.
      I was trying a Python 3 environment.
      I typed activate, it changed the command prompt to show the py3 environment had been activated.

      Yet when I ran the python command, it still ran Python 2.7. The only way to run the Python 3 interpreter was to go into that directory, which beats the purpose of environments.

      Going online, it seems quite a few people have faced this problem, and there are many creative solutions. However, I don’t have the time or inclination to try them.

      1. You can try typing “source activate py3” in shell to change to python3 environment. But the precondition is that you have configured your environment.
        PS: “py3” is the name you defined of your python 3 package, so it should be changed according to your practical situation.

  2. If you go to c: from c:\Anaconda after you change to an environment then all the usual commands like spyder. will execute in the env you have activated. This is because the c:\Anaconda directory will overrule the path set in the activate command.

Leave a Reply

Your email address will not be published. Required fields are marked *