Roel Bruggink
Roel Bruggink
5 april 2016

Installing Plone 5 using pip

You do not need buildout to install Plone. Here's how.

A couple of years back we moved forward by converting Zope and Plone packages into eggs. This made us more on-par with the Python community. We also started using zc.buildout for managing our environment. One of the biggest wins of buildout was version pinning without installing eggs. This allows for a community wide effort to define a set of versions of packages that are known to works with an application (a Known Good Set). In the Plone world we use multiple KGSs. For example, the Plone 5 KGS extends the Zope2 KGS (which extends the ZTK KGS). The Plone KGS also overrides specific -or ‘pins’- versions, ie ‘Products.ZCatalog = 3.0.2’ vs ‘Products.ZCatalog = 2.13.17’.

The Python community nowadays mostly uses pip + a container (virtualenv, docker, etc) over buildout. Luckily pip now support constraint files. Constraint files specify version pins, but do not declare a concrete dependency. This also works for Plone, but we will have to create a constraints file (they do not yet exist for Plone and Zope). Install zc.buildout in a container and run the script.

virtualenv-2.7 .
./bin/pip install -U setuptools pip zc.buildout
curl -o
./bin/python > constraints.txt
./bin/pip install Plone -c constraints.txt

Next you should see something like this in your console:

❯ ./bin/pip install Plone -c constraints.txt
Collecting Plone==5.0.3 (from -c constraints.txt (line 343))
 Using cached
Collecting (from -c constraints.txt (line 354))
 Using cached
Collecting Zope2==2.13.24 (from -c constraints.txt (line 359))
 Using cached Zope2-2.13.24.tar.gz
Collecting (from -c constraints.txt (line 361))
 Using cached
Collecting zope.deferredimport==3.5.3 (from -c constraints.txt (line 362))
 Using cached zope.deferredimport-3.5.3.tar.gz
Collecting DocumentTemplate==2.13.2 (from -c constraints.txt (line 369))
 Using cached
Collecting Products.ExternalMethod==2.13.1 (from -c constraints.txt (line 372))
 Using cached
Collecting Products.CMFPlone== (from -c constraints.txt (line 375))
 Downloading Products.CMFPlone- (18.1MB)
 100% |████████████████████████████████| 18.1MB 41kB/s

We can almost run our new Plone instance, but we need to create a few files. Normally I would create these using something like Cookiecutter, but for now this will have to do.
We have to create a Zope instance by hand:

./bin/mkzopeinstance --python=bin/python --user=admin:admin -d instance0

(un)Fortunately we cannot use z3c.auctoinclude, as it tries to read from the sys.path entries to load package. So we’ll need minimal custom site.zcml to make my Plone 5 instance run without z3c.autoinclude.

curl -o ./instance0/etc/site.zcml

Next we can start our Plone instance by disabling z3c.autoinclude:


And finally we’ll open our browser and point to http://localhost:8080/:

Create Plone site on pip Edit the Plone front-page in pip

We love code