Python usage survey 2014

Remember that Python usage survey that went around the interwebs late last year? Well, the results are finally out and I’ve visualized them below for your perusal. This survey has been running for two years now (2013-2014), so where we have data for both years, I’ve charted the results so we can see the changes in Python usage over time.

I’ll note that a big focus of this survey is to find out if Python users are transitioning over to Python 3, and if they aren’t, then why they aren’t making that transition. If you’re on the fence about switching from Python 2 to 3, there are some great articles out there about the key differences between the two versions and the many, many, …many advantages that Python 3 offers over Python 2.

If you want to check out the underlying data yourself, head on over to Bruno Cauet’s page.


The first big question that we all we know is: How many Python users have actually used Python 2 and 3?

python-survey-2014-used-2x-3x

As expected, nearly every Python user has used Python 2 at some point in their career. We also see good news for Python 3 over the past year: Python 3 usage increased 12 percentage points in 2014, up to nearly 3/4 of the surveyed Python users.


Of course, “writing code with Python 3 once” doesn’t mean that they actually use it regularly. The question below gets at that question more directly.

python-survey-2014-use-2x-3x-more

Here we see yet more good news for Python 3: As much as 10% more Python users are primarily using Python 3 than in 2013, now accounting for 1/3 of all Python users. It seems the transition to Python 3 will be slow but steady for the next few years.


The transition we see above may be caused by project managers at work. What version do Python users go to when working on their personal projects?

python-survey-2014-personal-project

Here we see a more close divide between the two versions: Nearly half of all users will start up their own projects with Python 3, whereas the other half still ardently remains pro-Python 2.


Let’s break these usage patterns down by the specific version now.

python-survey-2014-versions-regularly-use

Somehow, Python v. 2.5 and 2.6 are still in use in some places, but 2.7 still dominates the Python 2 landscape. We also see telltale signs that Python 3 is becoming a mature language in its own right, with users stuck in the older 3.2 and 3.3 versions.


To summarize so far: Over 2/3 of all Python users are still using Python 2, with the majority of them sitting at 2.7. This tells us that Python is still very much a divided language, with a large portion of the user base unwilling to upgrade to the latest version despite the fact that Python 2 nearly 5 years old now. (That’s ancient in programming language years!)

A common complaint of the ardent Python 2 users is that Python 3 was a huge mistake. How does that turn out in this survey?

python-survey-2014-python3-mistake

Surprisingly, it seems the complainers are a minority: Only 12% of the Python users surveyed think Python 3 was a mistake. 1/3 of Python users think Python 3 is great (probably the ones who made the switch!), whereas over half of Python users think the Python developers could’ve made the Python 2 -> 3 transition more fluid.


So, most Python users don’t think Python 3 was a mistake, but 2 in 3 of them still haven’t made the switch. That leaves us to wonder: Why haven’t the Python 2 users made the switch yet?

python-survey-2014-prevent-upgrade

Package dependencies are — by far — the most-cited reasons for refusing to switch to Python 3. Many of us rely on specific packages — such as numpy, scipy, pandas, etc. — for our day-to-day work. If the packages haven’t been upgraded to Python 3 yet, then why should we? Lucky for us, there’s a web site dedicated to tracking the packages that are Python 3 ready. Are all of your packages on there? Then maybe it’s time to make the switch.

Another common reason for refusing to switch to Python 3 is that there’s no incentive. We’re comfortable with Python 2, we know its ins and outs, and everything works fine. Why bother upgrading? If you fall in this category, I’ll point you to this article again that compares the key differences between Python 2 and 3. And don’t forget about the 2 pounds of reasons why Python 3 is a huge upgrade over Python 2.

The last two major reasons for refusing to switch to Python 3 are a little harder to address. If you have a large legacy code base or your manager simply refuses to make the upgrade, then it’s up to you to convince management (or yourself) that the upgrade is worth the work. The links I included in the above paragraph are a good start.


Finally, the survey wanted to look at cross-compatibility between Python 2 and 3.

python-survey-2014-ported-code-2x-3x

Here we start to see more good news for the future of Python 3: We saw a significant increase in the number of users who have ported their code from Python 2 to 3.


It’s not very well-known that there Python has packages for converting code from Python 2 to 3 and Python 3 to 2. When the survey asked users whether they’d used either of these packages even once, well, see for yourself…

python-survey-2014-used-u2to3-3to2

It seems like the Python devs need to do a better job of raising awareness of these code conversion packages.


Because Python 2 and 3 really aren’t that different, it’s not necessary to write code for just one version. As the famous taco shell commercial goes: “Por que no los dos?” (Why not both?)

To that end, the survey also polled users on whether they write Python 2- and 3- compatible code.

python-survey-2014-written-code-2x-3x-unmodified

Apparently only 1 in 3 Python developers bother to write multi-version compatible code, and there hasn’t been much of a change since 2013.


I look forward to seeing how the Python 3 transition progresses in 2014. If you have any more resources for helping (and convincing!) Python developers to make the transition, please share them in the comments below.

Dr. Randy Olson is a Senior Data Scientist at the University of Pennsylvania, where he develops state-of-the-art machine learning algorithms with a focus on biomedical applications.

Posted in data visualization, python Tagged with: , ,
  • Pingback: 1p – Python usage survey – now with pretty graphs and statistics – Exploding Ads()

  • Pingback: 1p – Python usage survey – now with pretty graphs and statistics – blog.offeryour.com()

  • pyrAmider

    Thanks for including links to further learning about most of these topics. Given the split between versions 2 and 3 in the Python world, I’m particularly curious about why only a third of respondents write code that’s multi-version compatible.

    Perhaps if you include a link to a resource where people can learn more about writing multi-version compatible code, more of your readers will be tempted to start the journey of the 2-to-3 switch by keeping one foot on either side of the divide for a while. This will have the added benefit of allowing them to write code that won’t have to be ported once they finally do decide to go all the way to 3.

  • p47

    I want to recommend a few readings, given the awfully misleading use of graphs.

    http://en.wikipedia.org/wiki/Misleading_graph#Truncated_graph
    http://www.statisticshowto.com/misleading-graphs/

  • Florian Heigl

    I was just referred to this and I’d love if you next time explained, for devs, who need it in very big writing, that this survey does not reflect the install base of python. it means which python versions are commonly used for projects.
    The installed base is utterly different and this has two problematic meanings:
    in any large infrastructure based on any stable OS (be it rhel style, debian style, even a “normal” freebsd version) the python version will be 1-3 steps behind what dev thinks is a good choice for a new project…
    deploying applications is thus always problematic since development happens on versions with better / more extensive / bugfixed features. in production / on the user side (might be different place alltogether) people now need to introduce funny patches to support / supplement the missing lang features. That means their setup will be a lot more fragile or features being torn out of the application to just make it work.

    building applications on versions of python that aren’t used in the wild (instead of developing on common versions and including your fav libraries etc) is completely pointless and waste endless time around the world for nothing – except the dev having been able to what he thinks the most favourable version. That people can’t use…

    Get it in your heads and use the most recent *common* version.
    It might save people so much time they can do their OS updates earlier because they won’t need t spend that time making your stuff run and doing the version tests you didn’t do.

  • Carlos Garza

    I’m tired of writing polyglot 2and3 python code. Lets finish this transition already.

  • Would you consider doing an updated version of this post and survey? As a Python project maintainer I would find updated information in this area (especially with Python 2.6 usage) quite valuable!

    • Has an updated version of the survey been released yet?

  • yetanotherlogin

    landed here after searching notorious “python 2 vs 3” on google. seems like new results for 2015 would be out soon?

  • Ben Coman

    I wonder if you could include a question to determine how many people have contributed to python itself?