Python on the CS Webservers
Python is supported as a CGI program on the CS Department webservers, but there are a few things you should know about it.
You may also want to read about Python on the CS Linux Clients.
Python Versions
The web servers have both Python 3 and Python 2 available. As of February 2021, the web servers are using Python 3.6 by default. This is different from the Linux clients, which use a newer version. (As of fall 2025, the Linux clients use Python 3.13 by default.) If you're writing programs to run on one of the department web servers, we recommend you restrict those programs to use only features available in the web servers' version of Python 3.
The web servers have several other versions of Python available. The Python versions available on both the web servers and the Linux clients are:
- Python 3.6 (default on the web servers)
- Python 3.9
- Python 3.11
- Python 3.12
- Python 3.13 (default on the Linux clients)
The version of Python used for your programs will depend on what interpreter you call at the top of your program. If you use #!/usr/bin/env python
or #!/usr/bin/env python3
, you will get the default Python for the system (which, again, will be different between the web server and the Linux client you can log in to). If you use #!/usr/bin/env python2
, you will get Python 2.7 on the web server and the program will not work on our Linux clients. You can also give the precise version of Python you want; for example, #!/usr/bin/env python3.11
will use Python 3.11 on both the web server and the Linux clients.
(It's good practice to explicitly use python3
when you intend to use Python 3. Using python
by itself is only recommended in a handful of situations that mostly don't apply to our web servers.)
Python Packages
The set of Python packages installed on the webservers is fairly minimal. If you need a package that's not installed, you should first try installing it yourself into your home directory, using our self-installation instructions. If that does not work, you can contact us at support@cs.jhu.edu for assistance, but be aware that we are not be able to install every requested package.
If you need a package that is not supported on our web servers' default Python version, you can use the versioned Python executable to set up the virtual environment. For example, if you had a package that needed Python 3.11 or later, you could run python3.11 -m venv /path/to/venv/directory. If you run a Python program in such a venv, it will use the version of Python you used to set up the venv, even if the program starts with #!/usr/bin/env python3
or #!/usr/bin/env python
.
See the previous section for which versions of Python are available on both our web servers and our Linux clients.
Deployment Options
For technical reasons, we do not support WSGI. You will have to run your Python programs as either CGI or FastCGI programs. (Most major Python web frameworks support FastCGI deployment; see their documentation for details.)