Installation

Prerequisites: Python

p5 requires Python 3. Most recent versions of MacOS and Linux systems should have an installation of Python already. If you’re not sure which version your computer is using, run

python --version

from a terminal window. If the reported version is greater than 3.0, you’re good to proceed.

If you don’t already have Python installed, refer to the The Hitchhiker’s Guide To Python and its section on Python installation. Alternatively, on Windows, you can also consider installing Python through the Miniconda Python installer.

Prerequisites: GLFW

Internally p5 uses GLFW to handle window events and to work with OpenGL graphics.

Windows

First, download and install the pre-compiled Windows binaries from the official GLFW downloads page. During the installation process, make sure to take note of the folder where GLFW.

Finally, the GLFW installation directory should be added to the system path. Make sure to add containing the .dll and .a files (for example: \<path to glfw>\glfw-3.2.1.bin.WIN64\lib-mingw-w64)

First locate the “Environment Variables” settings dialog box. On recent versions of Windows (Windows 8 and later), go to System info > Advanced Settings > Environment Variables. On older versions (Windows 7 and below) first right click the computer icon (from the desktop or start menu) and then go to Properties > Advanced System Settings > Advanced > Environment Variables. Now, find and highlight the “Path” variable and click the edit button. Here, add the GLFW installation directory to the end of the list and save the settings.

MacOS, Linux

Most package systems such as homebrew, aptitude, etc already have the required GLFW binaries. For instance, to install GLFW on Mac using homebrew, run

$ brew install glfw

Similarly, on Debain (and it’s derivatives like Ubuntu and Linux Mint)run

$ sudo apt-get install libglfw3

For other Linux based systems, find and install the GLFW package using the respective package system.

Installing p5

The p5 installer should automatically install the required dependencies (mainly numpy and vispy), so run

$ pip install p5 --user

to install the latest p5 version. In case the automatically installation fails, try installing the dependencies separately:

$ pip install numpy
$ pip install vispy

In case of other installation problems, open an issue on the main p5 Github repository.