This section was modified from the original Pyramid Quick Tutorial Requirements.

Let's get our tutorial environment setup. Most of the setup work is in standard Python development practices (install Python, make an isolated environment, and setup packaging tools.)


Pyramid encourages standard Python development practices with packaging tools, virtual environments, logging, and so on. There are many variations, implementations, and opinions across the Python community. For consistency, ease of documentation maintenance, and to minimize confusion, the Pyramid documentation has adopted specific conventions.

This Pyramid Blogr Tutorial is based on:

  • Python 3.3. Pyramid fully supports Python 3.2+ and Python 2.6+. This tutorial uses Python 3.3 but runs fine under Python 2.7.
  • pyvenv. We believe in virtual environments. For this tutorial, we use Python 3's built-in solution, the pyvenv command. For Python 2.7, you can install virtualenv.
  • pip. We use pip for package management.
  • Workspaces, projects, and packages. Our home directory will contain a tutorial workspace with our Python virtual environment(s) and Python projects (a directory with packaging information and Python packages of working code.)
  • UNIX commands. Commands in this tutorial use UNIX syntax and paths. Windows users should adjust commands accordingly.


Pyramid was one of the first web frameworks to fully support Python 3 in October 2011.


  1. Install Python 3.3 or greater
  2. Workspace and project directory structure
  3. Set an environment variable
  4. Create a virtual environment
  5. Install Pyramid

Install Python 3.3 or greater

Download the latest standard Python 3.3+ release (not development release) from

Windows and Mac OS X users can download and run an installer.

Windows users should also install the Python for Windows extensions. Carefully read the README.txt file at the end of the list of builds, and follow its directions. Make sure you get the proper 32- or 64-bit build and Python version.

Linux users can either use their package manager to install Python 3.3+ or may build Python 3.3+ from source.

Workspace and project directory structure

We will arrive at a directory structure of workspace -> project -> package, with our workspace named blogr_tutorial. The following tree diagram shows how this will be structured and where our virtual environment will reside as we proceed through the tutorial:

└── projects/
    └── blogr_tutorial/
        ├── env/
        └── pyramid_blogr/
            ├── CHANGES.txt
            ├── README.txt
            ├── development.ini
            ├── production.ini
            ├── pytest.ini
            ├── pyramid_blogr/
            │   ├──
            │   ├── models
            │   │   ├──
            │   │   ├──
            │   │   └──
            │   ├──
            │   ├── scripts/
            │   │   ├──
            │   │   └──
            │   ├── static/
            │   │   ├── pyramid-16x16.png
            │   │   ├── pyramid.png
            │   │   └── theme.css
            │   ├── templates/
            │   │   ├── 404.jinja2
            │   │   ├── layout.jinja2
            │   │   └── mytemplate.jinja2
            │   ├──
            │   └── views
            │   │   ├──
            │   │   ├──
            │   │   └──

For Linux, the commands to do so are as follows:

# Mac and Linux
$ cd ~
$ mkdir -p projects/blogr_tutorial
$ cd projects/blogr_tutorial

For Windows:

# Windows
c:\> cd \
c:\> mkdir projects\blogr_tutorial
c:\> cd projects\blogr_tutorial

In the above figure, your user home directory is represented by ~. In your home directory, all of your projects are in the projects directory. This is a general convention not specific to Pyramid that many developers use. Windows users will do well to use c:\ as the location for projects in order to avoid spaces in any of the path names.

Next within projects is your workspace directory, here named blogr_tutorial. A workspace is a common term used by integrated development environments (IDE) like PyCharm and PyDev that stores isolated Python environments (virtualenvs) and specific project files and repositories.

Set an environment variable

This tutorial will refer frequently to the location of the virtual environment. We set an environment variable to save typing later.

# Mac and Linux
$ export VENV=~/projects/blogr_tutorial/env

# Windows
# TODO: This command does not work
c:\> set VENV=c:\projects\blogr_tutorial\env

Create a virtual environment


The current state of isolated Python environments using pyvenv on Windows is suboptimal in comparison to Mac and Linux. See for a discussion of the issue and PEP 453 for a proposed resolution.

pyvenv is a tool to create isolated Python 3 environments, each with its own Python binary and independent set of installed Python packages in its site directories. Let's create one, using the location we just specified in the environment variable.

# Mac and Linux
$ pyvenv $VENV

# Windows
c:\> c:\Python33\python -m venv %VENV%

See also

See also Python 3's venv module. For instructions to set up your Python environment for development on UNIX or Windows, or using Python 2, see Pyramid's Before You Install.

Install Pyramid

We have our Python standard prerequisites out of the way. The Pyramid part is pretty easy:

# Mac and Linux
$ $VENV/bin/pip install pyramid==1.7

# Windows
c:\> %VENV%\Scripts\pip install pyramid==1.7

Our Python virtual environment now has the Pyramid software available.

With the requirements satisfied, you may continue to the next step in this tutorial 1. Create your pyramid_blogr project structure.