{"id":6273,"date":"2019-08-29T08:20:49","date_gmt":"2019-08-29T08:20:49","guid":{"rendered":"https:\/\/gtechbooster.com\/?p=6273"},"modified":"2023-04-01T01:36:50","modified_gmt":"2023-04-01T01:36:50","slug":"security-threatened-by-python-2-end-of-life","status":"publish","type":"post","link":"https:\/\/gtechbooster.com\/security-threatened-by-python-2-end-of-life\/","title":{"rendered":"Security threatened by Python 2 end of life"},"content":{"rendered":"\n<p>Python 2&#8217;s end of life is fast approaching and the UK&#8217;s National Cyber  Security Centre has issued a warning to developers still clinging on to  Python 2 of risks they will face as a result of no more bug fixes or  security updates.<\/p>\n\n\n\n<div class=\"gtech-migrated-from-ad-inserter-placement-2\" style=\"text-align: center;\" id=\"gtech-3330478382\"><div style=\"margin-left: auto;margin-right: auto;text-align: center;\" id=\"gtech-3053839602\"><a data-bid=\"1\" data-no-instant=\"1\" href=\"https:\/\/gtechbooster.com\/linkout\/78735\" rel=\"noopener\" class=\"notrack\" aria-label=\"005\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/gtechbooster.com\/media\/2026\/03\/005.webp\" alt=\"\"  srcset=\"https:\/\/gtechbooster.com\/media\/2026\/03\/005.webp 1000w, https:\/\/gtechbooster.com\/media\/2026\/03\/005-768x768.webp 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" width=\"500\" height=\"500\"  style=\"display: inline-block;\" \/><\/a><\/div><\/div><p>Much to the dismay of Python 3 adherents, Python 2, was given a stay \nof execution by Guido van Rossum in 2014. While being adamant that there\n would be no Python 2.8 and that the time had come to move to Python \n3.4, he announced at PyCon that instead of facing end of support in 2015\n as originally planned, Python 2 was being granted an extra 5 years to \n2020. This was in order to give time for numerous libraries relied on by\n existing projects to add Python 3 support.<\/p>\n\n\n\n<p>In March 2018 it was agreed that Python 2.7, the only version still \nsupported, would be completely dead on January 1st 2020, meaning&nbsp;no \nupdates, not even&nbsp;source-only security patches, after that date. And if \nyou think 2020 is still a long way off &#8211; you are wrong:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/gtechbooster.com\/media\/2019\/08\/python2eolbaner.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"175\" src=\"https:\/\/gtechbooster.com\/media\/2019\/08\/python2eolbaner.jpg\" alt=\"\" class=\"wp-image-6278\" srcset=\"https:\/\/gtechbooster.com\/media\/2019\/08\/python2eolbaner.jpg 400w, https:\/\/gtechbooster.com\/media\/2019\/08\/python2eolbaner-300x131.jpg 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>In view of this looming deadline, the National Cyber Security Centre \n(NCSC) has repeated the &#8220;time to move Python 3&#8221; message, saying:<\/p>\n\n\n\n<p><em>So, if you&#8217;re still using 2.x, it&#8217;s \ntime to port your code to Python 3. If you continue to use unsupported \nmodules, you are risking the security of your organisation and data, as \nvulnerabilities will sooner or later appear which nobody is fixing.<\/em><\/p>\n\n\n\n<p>Given that Python 3.0 was released in December 2008 and wasn&#8217;t  backward compatible with the 2.x line of releases, this advice seems  long overdue. But the Python community has been highly resistant to  change. It took, four years, until January 2013, i.e. 4 years, for the  number of monthly downloads of the latest Python 3 to exceed that of its  Python 2 counterpart.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/gtechbooster.com\/media\/2019\/08\/pythondownloads.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"244\" src=\"https:\/\/gtechbooster.com\/media\/2019\/08\/pythondownloads.jpg\" alt=\"\" class=\"wp-image-6275\" srcset=\"https:\/\/gtechbooster.com\/media\/2019\/08\/pythondownloads.jpg 400w, https:\/\/gtechbooster.com\/media\/2019\/08\/pythondownloads-300x183.jpg 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The main barrier to switching existing code from Python 2 to Python 3\n was their dependencies on third party packages. At the time of Python \n2&#8217;s EOL extension there were still a substantial number of widely used \nlibraries that didn&#8217;t support Python 3.x. This situation was monitored \nby on a website initially called the Python 3 Wall of Shame as it \ndisplayed in red the names of PyPi packages that&nbsp;were not compatible \nPython using green for those that did. It was renamed the Python 3 Wall \nof Superpowers as more and more green entries replaced red ones and, \nhaving achieved over 95% compatibility, stopped the exercise in April \n2018.<\/p>\n\n\n\n<p>Even so some users still cling to Python 2.x. Figures from the 2018  Python Developers Survey conducted jointly by the Python Software  Foundation and JetBrains.show that almost a fifth of Python developers  engaged in DevOps are stuck there, with almost as many web developers in  the same situation. The outlook is much better for Data Science, where  only 10% have yet to upgrade.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/gtechbooster.com\/media\/2019\/08\/jbpython3devs.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"423\" height=\"251\" src=\"https:\/\/gtechbooster.com\/media\/2019\/08\/jbpython3devs.jpg\" alt=\"\" class=\"wp-image-6276\" srcset=\"https:\/\/gtechbooster.com\/media\/2019\/08\/jbpython3devs.jpg 423w, https:\/\/gtechbooster.com\/media\/2019\/08\/jbpython3devs-300x178.jpg 300w\" sizes=\"auto, (max-width: 423px) 100vw, 423px\" \/><\/a><\/figure><\/div>\n\n\n\n<p> These figures look reasonably reassuring, but a different picture is  revealed by June 2019 stats of downloads of popular packages from the  Python Package Index collated by NCSC: <\/p><div class=\"gtech-mid-cont\" style=\"text-align: center;\" id=\"gtech-2990536272\"><div style=\"margin-right: auto;margin-left: auto;text-align: center;\" id=\"gtech-271887711\"><a data-bid=\"1\" data-no-instant=\"1\" href=\"https:\/\/gtechbooster.com\/linkout\/75343\" rel=\"noopener\" class=\"notrack\" aria-label=\"jesdphis\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/gtechbooster.com\/media\/2025\/08\/jesdphis.avif\" alt=\"\"  srcset=\"https:\/\/gtechbooster.com\/media\/2025\/08\/jesdphis.avif 1179w, https:\/\/gtechbooster.com\/media\/2025\/08\/jesdphis-768x950.avif 768w\" sizes=\"(max-width: 1179px) 100vw, 1179px\" width=\"300\" height=\"300\"  style=\"display: inline-block;\" \/><\/a><\/div><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/gtechbooster.com\/media\/2019\/08\/pypidownloads.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"349\" height=\"587\" src=\"https:\/\/gtechbooster.com\/media\/2019\/08\/pypidownloads.jpg\" alt=\"\" class=\"wp-image-6277\" srcset=\"https:\/\/gtechbooster.com\/media\/2019\/08\/pypidownloads.jpg 349w, https:\/\/gtechbooster.com\/media\/2019\/08\/pypidownloads-178x300.jpg 178w\" sizes=\"auto, (max-width: 349px) 100vw, 349px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The four of the packages listed at the top of the table had more \ndownloads for Python 2 than Python 3 and even where Python 3 is more \npopular a substantial proportion are still for Python 2. To force this \nsituation to improve many projects including NumPy, Requests, and \nTensorFlow have pledged to drop support for 2.x by 2020 and some already\n have. As NCSC points out,<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>This means that if you want to use the  latest features of your favourite modules, you\u2019ll need to be using  Python 3.&nbsp;The longer you wait to update, the more the Python 3 versions  of your dependencies will have changed, and the more difficult updating  will become.<\/em><\/p><\/blockquote>\n\n\n\n<p>Another point raised by NCSC is that failure to move on is holding other developers back, stating:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>If you maintain a library that other  developers depend on, you may be preventing them from updating to 3. By  holding other developers back, you are indirectly and likely  unintentionally increasing the security risks of others.<\/em><\/p><\/blockquote>\n\n\n\n<p>It also has some recommendations to assist in the process of porting Python 2.x code to Python 3, mentioning:&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/brettcannon\/caniusepython3\" rel=\"noreferrer noopener\" target=\"_blank\">Can I Use Python 3<\/a>&nbsp;&#8211; a program that checks your project dependencies to see if any are preventing you from using Python 3.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.python.org\/2\/library\/2to3.html\" rel=\"noreferrer noopener\" target=\"_blank\">2to3<\/a>&nbsp;&#8211;\n a Python program, usually installed with the Python interpreter as a \nscript, that attempts to convert 2.x source code into 3. Note that this \nisn\u2019t perfect, you may still have to fix some code manually.<\/p>\n\n\n\n<p>There are plenty of features in Python 3 to reward those who make the\n move and in doing so you will also have the opportunity to improve how \nyou manage your software dependencies and minimize your&nbsp;security debt.<\/p>\n\n\n\n<p>Dropbox migrated its codebase to Python 3 in 2018 and gave details of the experience in a&nbsp;<a href=\"https:\/\/blogs.dropbox.com\/tech\/2018\/09\/how-we-rolled-out-one-of-the-largest-python-3-migrations-ever\/\" rel=\"noreferrer noopener\" target=\"_blank\">blog post<\/a>.\n The move was motivated by the fact that as Python 2 aged, the set of \ntoolchains initially compatible for deploying it had largely become \nobsolete, leading to a growing maintenance burden:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The use of older compilers\/runtimes was limiting our ability to upgrade some important dependencies.<\/li><li>For example, we use Qt on Windows and Linux: Recent versions of Qt \nrequire more modern compilers due to the inclusion of Chromium (via \nQtWebEngine).<\/li><li>As we continued to integrate deeply with the operating system, our \ninability to rely on more recent versions of these toolchains increased \nthe cost of adoption for newer APIs.<\/li><li>For example, Python 2 still&nbsp;technically&nbsp;requires Visual Studio 2008. This version is no longer supported by Microsoft and is not compatible with the Windows 10 SDK.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">More Information<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/pythonclock.org\/\" target=\"_blank\">Python 2.7 will retire in &#8230;<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.ncsc.gov.uk\/blog-post\/time-to-shed-python-2\" target=\"_blank\">Time to shed Python 2<\/a><\/li><li><a href=\"https:\/\/www.python.org\/\">Python.org<\/a><\/li><\/ul>\n\n\n\n<p>Credit: <strong>iProgrammer.info<\/strong><\/p>\n<div class=\"gtech-end-cont\" id=\"gtech-3254149931\"><div style=\"margin-left: auto;margin-right: auto;text-align: center;\" id=\"gtech-3918193493\"><a data-bid=\"1\" data-no-instant=\"1\" href=\"https:\/\/gtechbooster.com\/linkout\/78735\" rel=\"noopener\" class=\"notrack\" aria-label=\"005\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/gtechbooster.com\/media\/2026\/03\/005.webp\" alt=\"\"  srcset=\"https:\/\/gtechbooster.com\/media\/2026\/03\/005.webp 1000w, https:\/\/gtechbooster.com\/media\/2026\/03\/005-768x768.webp 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" width=\"500\" height=\"500\"  style=\"display: inline-block;\" \/><\/a><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Python 2&#8217;s end of life is fast approaching and the UK&#8217;s National Cyber Security Centre has issued a warning to developers still clinging on to Python 2 of risks they will face as a result of no more bug fixes or security updates. Much to the dismay of Python 3 adherents, Python 2, was given [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":6279,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1915],"tags":[1444,236,6,671],"class_list":["post-6273","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ndocs","tag-cyber-security","tag-data-security","tag-programming","tag-python"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"_links":{"self":[{"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/posts\/6273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/comments?post=6273"}],"version-history":[{"count":0,"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/posts\/6273\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/media\/6279"}],"wp:attachment":[{"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/media?parent=6273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/categories?post=6273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gtechbooster.com\/api-json\/wp\/v2\/tags?post=6273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}