Please read even if you already have Python installed
For security, consistency, and readability, OpenSAFELY provides an API built in Python for using the platform. This API includes script-based functions for specifying the patients and variables that make up a study dataset (using a study definition), and command line functions for importing codelists, generating dummy data, and testing that the study definition can be run successfully on the server. Python version 3.7 or higher must be installed on your machine to perform these tasks.
Many functions are provided in a Python module called
opensafely which will also need to be installed — see the
opensafely CLI section for more details.
For Windows users, we recommend that you install Anaconda (Individual Edition), a popular Python distribution that includes an recent version of Python, many useful Python packages, and an environment manager. This will help avoid some fiddly annoyances when dealing with multiple versions/installations of Python.
To install, follow these instructions. Accept the default/recommended settings unless you understand the consequences of changing them.
This should have added Python and Anaconda Prompt to your machine (as well as a few other things).
To verify that you can run Python with Anaconda Prompt, open it and run
You should use the Anaconda Prompt whenever you want to use the
Go to the
opensafely CLI section for instructions on how to install this module.
Not yet documented