Programming language Python 2's end looms, so why will many miss the deadline?

Python 2 may be reaching end of life, but old Python 2 code will remain around for years to come.
Written by Liam Tung, Contributor on

In August, the UK's National Cyber Security Centre (NCSC) warned that organizations should migrate code off Python 2 because from January 1, 2020 it will no longer receive security fixes. 

"If you continue to use unsupported modules, you are risking the security of your organization and data, as vulnerabilities will sooner or later appear, which nobody is fixing," it said. 

That problem is compounded by developers who created dependencies or software libraries with Python 2, which in turn prevent developers downstream from upgrading to Python version 3.    

It's been a slow road to getting developers to migrate code bases to Python 3, which was launched in 2008. Six years before Python 2 would reach the end of its life, the recently retired Python creator Guido van Rossum declared in 2014 that "it's time to move on to Python 3". 

SEE: Six in-demand programming languages: Getting started (free PDF)    

There's even a countdown clock to remind people exactly how many minutes of support remain for Python 2.7. It's currently just one month plus a few hours over 16 days.  

Vicki Boykis, a US-based data scientist, has now outlined on the Stack Overflow blog her views on why it's taking developers so long to port their Python 2 code to Python 3.  

She places some of the blame on van Rossum's description of Python 3 in the official 'Python Enhancement Proposals' (PEP) document, which initially characterized Python 3 as a "relatively mild improvement on Python 2".  

"Many people didn't switch for what they perceived to be as mostly an inconvenience," writes Boykis. "At that time, the largest difference was changing of the print statement to Python function syntax, which broke a lot of code. As a result, Python 2 continued to be in active development."

Another major obstacle to Python 3 migration has been that it is not backwards compatible with Python 2. 

"As a result, major libraries were hesitant to move to the platform, and in a self-fulfilling prophecy, and it was hard to port the code with a lack of supporting tools," she notes. 

Fortunately, over the years Python 3 has gained substantial feature improvements that have helped it become the default for new development. But that's not necessarily true for existing projects.     

Nevertheless, while dependencies can be a drag on Python 3 migration, progress has been made. Following a survey of Python developers, IDE maker JetBrains predicted that all developers would move to Python 3 before Python 2's end of life.

SEE: Programming languages: Python overtakes Java on GitHub as Google Dart use soars  

Also helpful have been major Python 2 to Python 3 migrations, which happened at Dropbox in the fall of 2018. Dropbox of course had hired van Rossum to help manage its massive four million lines of Python code. Other major Python 3 migrations have happened at Instagram and Facebook in recent years. 

But while tech giants may have successfully migrated, Boykis reckons some enterprise organizations, such as banks, will keep on using Python 2. Hence NCSC's alert, which was probably aimed at the UK's massive banking sector. 

JPMorgan's Athena trading platform is reportedly built on 35 million lines of Python 2.7 code and, according to a report by eFinancialCareers, the banking giant only kicked off its Python migration in late 2018. Instagram started its migration in 2017. 

Boykis points out that as of September 2019 at least 40% of all packages downloaded from The Python Package Index (PyPI) are from version 2.7. That proportion has declined but it is still a striking number, given the closeness of Python 2's end of life. 

"Most large organizations, outside the hype cycle of technical news posts, move much more slowly than the press or blogs would have you think. Most major banks are still running some variation of Fortran and COBOL under the covers, for example," writes Boykis. 

"With regards to Python 2, we'll see that 40% number shrink further in 2020, but the changes will be incremental, and there will be companies running Python 2.7 well into the future."

More on Python and programming languages

  • Google: As Go programming language turns 10, here are the big names using it
  • Python programming language creator retires, saying: 'It's been an amazing ride'
  • Programming languages: How Instagram's taming a multimillion-line Python monster
  • Salesforce: Why we ditched Python for Google's Go language in Einstein Analytics  
  • Python-inspired Nim: Version 1.0 of the programming language launches
  • Microsoft TypeScript 3.7: Programming language beta lands with all these features
  • Google: Take our free Kotlin programming language courses to build Android apps
  • Microsoft: We want you to learn Python programming language for free
  • Google: Dart 2.5 programming language SDK will 'supercharge' developers
  • Raspberry Pi gets MIT's Scratch 3 programming language for Raspbian
  • Julia programming language: Users reveal what they love and hate the most about it
  • Programming language Python's 'existential threat' is app distribution: Is this the answer?
  • Is Julia fastest-growing new programming language? Stats chart rapid rise in 2018
  • Python vs R for data science: Professor rates programming language rivals
  • Programming languages: Python predicted to overtake C and Java in next 4 years 
  • Netflix: Python programming language is behind every film you stream
  • JPMorgan's Athena has 35 million lines of Python code, and won't be updated to Python 3 in time TechRepublic
  • Mozilla's radical open-source move helped rewrite rules of tech CNET
  • Related

    The 5 best Peloton alternatives of 2022

    The 5 best Peloton alternatives of 2022

    The 5 best camera accessories of 2022

    The 5 best camera accessories of 2022

    Mobile Accessories
    iPad Air (2022) vs iPad Pro (2021): What's the difference?

    iPad Air (2022) vs iPad Pro (2021): What's the difference?