Skip to content

easy_install Plone – Installing Plone 4 without buildout

May 15, 2010

UPDATE (May 16, 2010): I tried to pin the versions by making a requirements.txt, and with the command “pip install -r requirements.txt”, this did successfully check out the proper versions of all the eggs and install them into the virtualenv’s site-packages directory, but when I try to start up the Zope instance with ./bin/zopectl fg, I get this traceback.

So apparently, as Alex Clark mentions below in the comments, this is probably due to missing ZCML slugs that are provided when you use the zope2instance buildout recipe. It’s strange though that when using easy_install Plone before, I was at least able to get Zope to start up, and display the create new Plone site page.

UPDATE (May 15, 2010): Plone gurus Martin Aspeli and Hanno Schlichting advise in the comments of this blog post, that what I’m describing is not recommended, and will result in a broken Plone site. Oh well, I guess this was all wishful thinking and a thought experiment, and I’ll just have to go back to using buildout. … unless Erik Rose finishes his buildout free Plone install before he heads off to Mozilla to join other Plone/Python brethren Alexander Limi and Ian Bicking. ;)  (Whoever is in charge of hiring at Mozilla knows what they’re doing.)

PREFACE: The reason I’ve been trying to install Plone without buildout is because I wanted to use Ian Bicking’s silverlining to deploy Zope/Plone to a remote server. From what I could see with my limited experience with silverlining, there didn’t seem to be a way to tell it to run buildout on the remote server, but this may have changed since the last time I looked at it. Or maybe the approach is to run buildout locally, and then push the resulting directory up to the cloud, although I think silverlining expects all the eggs to be in the virtualenv’s lib/site-packages dir, and not buildout’s eggs dir.

Now with Plone 4, it’s even easier to install Plone because all the Zope components are available as eggs. Which means that you can install Plone the same way most Python packages are installed, with easy_install or you can use the Ian Bicking’s new pip, which is a replacement for easy_install. Of course, you probably still want to use zc.buildout since it’s still the defacto standard for developing and deploying Plone sites.

Step 1. Install Plone

Assuming you have all the system dependencies installed, you can install Plone with one simple command. If this doesn’t work, look below for what dependencies you need to install first.

$ easy_install Plone
...
Finished processing dependencies for Plone

Yes, it really is that easy. This one command will fetch Plone and all of it’s dependencies, including Zope and all of it’s dependencies. This takes a few minutes to run, so you might want to go grab a coffee or beverage of choice. If you experience errors, then look below in the Troubleshooting section.

Step 2. Make a Zope instance

Once you’ve installed Plone, then you need to create an instance with the command mkzopeinstance.

$ ./bin/mkzopeinstance
Please choose a directory in which you'd like to install
Zope "instance home" files such as database files, configuration
files, etc.

Directory: instance
Please choose a username and password for the initial user.
These will be the credentials you use to initially manage
your new Zope instance.

Username: admin
Password: ******
Verify password: ******

Now your instance has been created in a directory called “instance”.

Step 3. Start up the instance

Navigate into the instance directory that you just created and start up the instance with the zopectl command:

$ cd instance
$ ./bin/zopectl fg
/home/ubuntu/zope/instance/bin/runzope -X debug-mode=on
2010-03-21 01:16:33 INFO ZServer HTTP server started at Sun Mar 21 01:16:33 2010
 Hostname: 0.0.0.0
 Port: 8080
2010-03-21 01:16:51 INFO Zope Ready to handle requests

You can now go to http://localhost:8080 in your web browser and you should see the start screen for Plone 4, which in my opinion is a vast improvement over the previous not-very-friendly Zope Management Interface start screen.

So with three commands you have a running Zope instance! When you click on the button, Create a new Plone site, you are presented with another user-friendly screen:

Now you just give your site an ID and title, choose what language you want the default site to be in, and check off what add-ons you want to install. Then you click the button Create Plone site, and if you pinned all the eggs using a requirements.txt file, you would have a working Plone site at http://localhost:8080/Plone.

WARNING: if you don’t pin the eggs, it will run the install but fail with a traceback because it’s using incompatible zope eggs.

Dependencies

The two main requirements are Python 2.6 and gcc (to compile Zope’s C extensions). If you have a Mac running Snow Leopard then you already have Python 2.6, but you’ll need to install the XCode Developer DVD to get gcc and the other build tools. You’ll also need the Python Imaging Library (PIL) and the Python setuptools package which provides the easy_install command.

If you’re on Ubuntu/Debian, here’s one command that will install all the system dependencies that Plone 4 needs to run:

$ sudo apt-get update
$ sudo apt-get install build-essential \
                       python2.6-dev \
                       python-setuptools \
                       python-imaging \
                       python-virtualenv \

Making sandboxes with virtualenv

While python-virtualenv is not necessary, it does make it possible to create an isolated Python environment that doesn’t conflict with your system Python. In this way, you can install Plone in a sandbox, and not worry that it might pollute your global Python lib directory. Here’s an example of how to make a virtualenv called “zope”:

$ cd ~
$ virtualenv zope
$ cd zope
$ source ./bin/activate
(zope)$

Now anything you install with easy_install (including Plone), will be installed into ~/zope/lib instead of the system Python lib directory.

Troubleshooting

unable to execute gcc: No such file or directory

If you see some errors that look like the following, then it means you haven’t installed gcc and you should stop the install process and look below for instructions on how to remedy this.

unable to execute gcc: No such file or directory
********************************************************************************
WARNING:

 An optional code optimization (C extension) could not be compiled.

 Optimizations for this package will not be available!

command 'gcc' failed with exit status 1
********************************************************************************

If you experience this error, then you need to install gcc which is a different process depending on whether you’re on Mac, Windows or Linux. I’ll describe how to do it for Mac and Linux because on Windows it’s more involved.

Mac OSX: install the XCode Developer tools DVD that came with your computer. Once this is done installing, you should be able to type “gcc” at the Terminal prompt and see i686-apple-darwin10-gcc-4.2.1: no input files

Linux: On Ubuntu/Debian, type the following command:

sudo apt-get install build-essential

error: Python.h: No such file or directory

If you get this error it means that you haven’t installed the Python header files. If you’re on Ubuntu/Debian, you would type:

sudo apt-get install python2.6-dev

ImportError: No module named PIL

If you get this error, it means that you haven’t installed the Python Imaging Library (PIL). On Ubuntu/Debian, you would type:

sudo apt-get install python-imaging
10 Comments leave one →
  1. Hanno Schlichting permalink
    May 15, 2010 7:45 pm

    Please, DO NOT USE THIS!!!

    “easy_install Plone” will install an arbitrary set of latest development versions of the entire stack. It will at no point install an actual stable release. If the soup of packages you get happens to produce anything that starts up or even installs, that’s a little miracle. At this moment you will get a number of zope.* packages which are too new for Zope 2.12 and will break in various different ways. Tomorrow the breakage will probably be different and more.

    The only way you can use easy_install or pip is by using a specific index, which pins down every package to an exact version. You need to know a fair bit about setuptools and Python package management to do so.

    The Plone community only supports installing Plone via zc.buildout – either directly or via one of the binary installers. If you use easy_install you will be on your own.

    • May 15, 2010 7:49 pm

      Hanno – thanks for the quick response. I guess that explains why Plone was complaining when I tried to make a new site. ;) What about using pip with a requirements.txt file to pin all the versions? Could that be a suitable alternative to installing Plone with buildout?

      • May 16, 2010 4:07 am

        Hi Nate,

        Yes, a requirements.txt file could possibly work. But it seems a bit like cutting off your nose to spite your face. I can’t see many (any?) advantages of doing that instead of using zc.buildout. And given that “everyone” else in the community is using buildout, and the official installers are all buildout based, it means you’re always going to be rolling your own set of packages. At some point, you (or whoever did this for you) will get bored of doing that, and you’ll end up with an un-migratable installation.

        Martin

  2. May 16, 2010 4:08 am

    And here is what happens when you post something like this:

    http://mikewatkins.ca/2010/05/15/easy-install-often-isnt/
    :-(

  3. May 16, 2010 6:44 am

    Who is this Martin *Aspli* of which you speak? ;-)

    I think it’s certainly feasible to use Plone without buildout. The solution is either to create a separate index with *all* the packages you need, or to use some other KGS mechanism like the requirements.txt file in Pip.

    However, it’s unclear what benefits this gives you over buildout. If you have an environment where you can run easy_install, you can install buildout and use that to build your packages. And buildout gives other advantages, in terms of the many useful recipes that have sprung up to support a number of Plone deployment scenarios.

    The problem of easy_install blindly pulling in the latest versions of all requirements is not unique to Plone, (or even to Python). However, Zope and Plone consists of so many packages that the problem is more visible. That’s why we invest a lot of time in building and maintaining “known good sets” of packages that are tested together.

    Martin

    • June 2, 2010 8:59 pm

      I think the advantage is that it’s one less thing to worry about and one less thing for newbies to learn. Also, you can install a new package in seconds using easy_install where it can take minutes if you want to install a new package using buildout.

      I know that you lose a lot of your control and you’d need to install, but it can simplify the process dramatically for people used to just easy_installing things and don’t want to learn buildout.

      I was able to use the easy_install method and specify my own index server, then used mkzope2instance and created a zope2.ini file to be able to provide a wsgi solution for plone easily. Purely academic, but am glad to know we can go this route.

  4. May 16, 2010 2:08 pm

    I agree with Hanno and Martin, this is not something to be blogged about yet, but I would not express it quite like they do ;-)

    Yes, you end up with egg soup (latest version of every package), but in addition (as far as I can tell) you also end up with:

    - “Real” instead of fake eggs (ZTK packages whose modules we use via Five in Zope 2)
    - Missing ZCML “slugs” (Small bits of ZCML code that load components that comprise the Plone application, and its add-ons).

    Both of which can be avoided by using the plone.recipe.zope2instance Buildout recipe (http://pypi.python.org/pypi/plone.recipe.zope2instance).

    So in other words, to run Plone you need to assemble the parts, and Buildout helps you do that (similar to GNU Make, if you are familiar with that tool). With Plone 4, we no longer need the plone.recipe.zope2install recipe to download and compile Zope 2, so we have less moving parts, at least :-).

    For the record, it’s “easy” to install Plone with Buildout, see: http://svn.aclark.net/svn/public/buildout/plone/trunk/README.txt

    And incidentally, I wrote a book to try and eliminate all the confusion surrounding Plone and Buildout: https://www.packtpub.com/plone-3-3-site-administration/book

    Alex

  5. May 18, 2010 9:56 pm

    BTW, what Eric wants to do is to effectively eliminate Python packaging in favor of Debian-style packaging. That may be a desirable alternative for cloud/server-farm deployment, but has a completely different set of goals from either buildout or easy_install.

  6. March 19, 2013 10:43 am

    Hey guys,

    Please tell me how instal Plone themes on windows?
    Every where I see either its done using Linux terminal or Windows Command Promt.

    Thanks in Advance?

Trackbacks

  1. In Defense of PyPI | ACLARK.NET, LLC

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 297 other followers

%d bloggers like this: