Installing Zope

This document describes installing Zope with zc.buildout (the recommended method) or via pip.

Prerequisites

In order to install Zope, you must have the following prerequisites available:

  • A supported version of Python, including the development support if installed from system-level packages. Supported versions include:

    • 2.7
    • 3.5 - 3.8
  • Zope needs the Python zlib module to be importable. If you are building your own Python from source, please be sure that you have the headers installed which correspond to your system’s zlib.

  • A C compiler capable of building extension modules for your Python (gcc recommended).

  • If you are using a Python interpreter shipping with your Linux distribution, you need to install the matching Python development package. As example, for Python 3 on Ubuntu 18.04, you have to type the following:

    $ sudo apt-get install python3-dev
    

Installing Zope with zc.buildout

zc.buildout is a powerful tool for creating repeatable builds of a given software configuration and environment. The Zope developers use zc.buildout to develop Zope itself, as well as the underlying packages it uses. This is the recommended way of installing Zope.

Installing the Zope software using zc.buildout involves the following steps:

  • Download and uncompress the Zope source distribution from PyPI if you are using the built-in standard buildout configuration
  • Create a virtual environment
  • Install zc.buildout into the virtual environment
  • Run the buildout

The following examples are from Linux and use Zope version 4.0b10. Just replace that version number with your desired version.

Built-in standard buildout configuration

$ wget https://pypi.python.org/packages/source/Z/Zope/Zope-4.0b10.tar.gz
$ tar xfvz Zope-4.0b10.tar.gz
$ cd Zope-4.0b10
$ python3.7 -m venv .
$ bin/pip install -U pip zc.buildout
$ bin/buildout

Note

When using Python 2.7 instead of calling python3.7 -m venv . you have to install virtualenv and then call python2.7 -m virtualenv ..

Custom buildout configurations

Instead of using the buildout configuration shipping with Zope itself, you can also start with your own buildout configuration file.

The installation with a custom buildout configuration does not require you to download Zope first:

$ python3.7 -m venv zope
$ cd zope
<create buildout.cfg in this folder>
$ bin/pip install -U pip zc.buildout
$ bin/buildout

Minimum configuration

Here’s a minimum buildout.cfg configuration example:

[buildout]
extends =
    https://zopefoundation.github.io/Zope/releases/4.0b10/versions-prod.cfg
parts =
    zopescripts

[zopescripts]
recipe = zc.recipe.egg
interpreter = zopepy
eggs =
    Zope

Using plone.recipe.zope2instance

To make your life a lot easier, you can use plone.recipe.zope2instance to automate a lot of the configuration tasks from the following document, Configuring and Running Zope. plone.recipe.zope2instance has a myriad configuration options, please see the PyPI page.

[buildout]
extends =
    https://zopefoundation.github.io/Zope/releases/4.0b10/versions-prod.cfg
parts =
    zopeinstance

[zopeinstance]
recipe = plone.recipe.zope2instance
eggs =
    Products.TemporaryFolder
user = admin:adminpassword
http-address = 8080

One feature this kind of installation offers is the easy integration of WSGI servers other than the built-in waitress. You can specify a file path to a WSGI configuration file to use when starting the Zope instance. This works for WSGI servers that offer a PasteDeply-compatible entry point, like gunicorn. You will need to create the .ini file yourself, and don’t forget to include the WSGI server software egg in the eggs specification:

[zopeinstance]
recipe = plone.recipe.zope2instance
eggs =
    Products.TemporaryFolder
    gunicorn
user = admin:adminpassword
http-address = 8080
wsgi = /path/to/zope.ini

On Python 2 you can also forego the use of WSGI and create an old-fashioned ZServer-based installation by pulling in the ZServer egg and setting wsgi = off explicitly:

[zopeinstance]
recipe = plone.recipe.zope2instance
eggs =
    Products.TemporaryFolder
    ZServer
user = admin:adminpassword
http-address = 8080
wsgi = off

Installing Zope with pip

Installing the Zope software using pip involves the following steps:

  • Create a virtual environment
  • Install Zope and its dependencies

Example steps on Linux. Replace the version number “4.0b10” with the latest version you find on https://zopefoundation.github.io/Zope/:

$ python3.7 -m venv zope
$ cd zope
$ bin/pip install -U pip
$ bin/pip install Zope==4.0b10 \
  -c https://zopefoundation.github.io/Zope/releases/4.0b10/constraints.txt

Note

When using Python 2.7 instead of calling python3.7 -m venv zope you have to install virtualenv and then call python2.7 -m virtualenv zope.

You can also install Zope using a single requirements file. Note that this installation method might install packages that are not actually needed (i. e. more than are listed in the install_requires section of setup.py):

$ bin/pip install \
-r https://zopefoundation.github.io/Zope/releases/4.0b10/requirements-full.txt

If you are on Python 2 and want to use ZServer instead of WSGI , you’ll have to install that package seperately using the version spec in constraints.txt

$ bin/pip install \
-c https://zopefoundation.github.io/Zope/releases/4.0b10/constraints.txt \
ZServer

Building the documentation with Sphinx

If you have used zc.buildout for installation, you can build the HTML documentation locally:

$ bin/make-docs