easy_install Plone – Installing Plone 4 without buildout
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.
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.
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