Glastonbury: a new system image, with Python 3.9 and Ubuntu 20.04


If you signed up for an account on PythonAnywhere after 21 June 2021, you’ll have Python 3.9 available – you can use it just like any other Python version. Additionally, the underlying operating system for your account will be Ubuntu 20.04, rather than the 16.04 used by older accounts.

If you signed up before that date, you’ll be on an older “system image” – essentially the version of the operating system and the set of installed packages that you have access to. You can switch to the new system image from the “Account” page, but you may need to make changes to your code and/or virtualenvs to make everything work – there’s more information on the linked page.

This post has more details on what’s new in the glastonbury system image. There’s a lot!

A new and better operating system

The operating system is now Ubuntu 20.04. While this doesn’t make any huge changes to the system, it made a number of the things below possible…

Python version changes

  • Python 3.9 (specifically, 3.9.5) is now supported.
  • We’ve installed new point releases of the other installed Pythons:
    • 3.5.10
    • 3.6.13
    • 3.7.10
    • 3.8.5
  • You can now configure the Bash command python to run any version of Python that the image supports. Previously, with Ubuntu 16.04, that command had to always run Python 2.7, which was annoying. Ubuntu 20.04 does not have that restriction, so if you’re using glastonbury you can go to the “Account” page, switch to the “System image” tab, and specify which version you want it to run. The default is 3.9. If you change which version python runs, the pip, ipython, virtualenv, and various other commands will also automatically switch over to match the new version at the same time.
  • Python 2.7 and 3.5 have reduced support; both are still installed, but we no longer pre-install any packages for them apart from pip and various virtualenv-related things. That means that you can use them, but you’ll need to install any dependencies you need for yourself. Python 3.5 may be dropped in the next system image; however, we’re planning to keep basic Python 2.7 support for at least the next couple of images. Don’t let that hold you back from upgrading, though! The Python development team dropped all support for it (including security patches) back in January 2020 so you should really be using Python 3.x for everything.
  • Python 3.4 is no longer installed.
  • We now have PyPy 7.3.4 installed, with support for Python 2.7.18 and 3.7.10.

Python packages

We’ve installed over 40 new Python packages, and updated all of the ones that we already supported. We won’t list all of them here to prevent this post from getting absurdly long, but here are the highlights:

  • As web2py now supports Python 3.x, and we no longer fully support 2.7, new web2py sites in accounts using the new system image will be started using Python 3.9. You can update existing sites to use 3.9 by changing the Python version on the “Web” page, but you should make sure you’ve fully upgraded your install to the very latest version of web2py using your site’s admin interface before doing so.
  • The latest version of Selenium, which works with headless Chrome, is now installed by default.
  • We’ve installed the tflite (TensorFlow Lite) package, which (unlike normal Tensorflow) works without problems inside websites on PythonAnywhere.
  • We’ve fixed an error in our system installs of the socks modules for Python 3 – these had two different modules installed, and they were interfering with each other. Only the newest one is installed now.
  • There was also a similar problem with bcrypt, which we’ve also fixed.
  • tweepy is now installed for all Python versions
  • tensorflow and likewise Tensorflow
  • dash for graphical dashboard apps
  • python-poppler for PDFs
  • PyTorch for machine learning
  • We’ve replaced the no-longer maintained pycrypto library with pycryptodome.
  • You need to install it using pip, but Playwright now works.

Non-Python packages

We’ve updated all of the OS packages too, and installed another 45 of them. Highlights again:

  • The version of SQLite that we have installed now support the FTS4 and FTS5 full-text search modules.
  • The most recent Postgres client tools have been installed, so that you won’t need to install updated ones into your account if you create a new Postgres server.
  • We’ve upgraded Tesseract to a more recent version.
  • We’ve installed the Julia language, version 1.6 – you can start it with julia in a Bash console.
  • We’ve upgraded Lua, and also installed LuaRocks so that you can install newer versions yourself, along with other Lua modules.
  • libreoffice is now installed so that you can use it in headless mode for document processing.
  • ping and whois are now installed, and will work from paid accounts.
  • A lot of man pages were missing, but are now installed.
  • Powershell (for those that like the Windows way of doing things :-)
  • We’ve installed the ncdu disk space analyser, which is a terminal-mode tool that helps you to work out what is using up your disk quota.

Any questions?

If you asked for a particular package to be installed, and we’ve installed it, then we should have already let you know – and in the few cases where we found we couldn’t install a particular package, we’ll have emailed you about that too. But if you’re wondering what the status is of some particular thing that you expected to have fixed in the new system image, and you’ve not heard from us, then just drop us a line at support@pythonanywhere.com. And likewise, if you have any other questions, just let us know :-)

comments powered by Disqus