Setting up z3extproject

Before You Install

You will need Python version 2.4 or better to run z3extproject. It has been tested under Python 2.4.5, Python 2.5.4. Development of z3extproject is currently done primarily under Python 2.5. z3ext does not run under any version of Python before 2.4, and does not run under Python 3.X.

Note

You will need setuptools installed on within your Python system in order to run the easy_install command.

Note

Installation of z3extproject does not require the compilation of any C code, so as long as you have a Python interpreter that meets the above requirements, you do not need to have development tools installed on the target machine to install z3extproject.

z3ext is known to run properly on all popular Unix-like systems such as Linux, MacOS X, and FreeBSD.

z3extproject does run on Windows systems. However, none of its developers use Windows as a primary development platform. Therefore, most of the platform-specific documentation (excepting this chapter) assumes you’re using a UNIX system. If you’re using a Windows system, you’ll need to transliterate command lines in the documentation to their Windows equivalents.

Installing z3extproject on a UNIX System

It is advisable to install z3extproject into a virtualenv in order to obtain isolation from any “system” packages you’ve got installed in your Python version (and likewise, to prevent z3extproject from globally installing versions of packages that are not compatible with your system Python). It can also be used as a solution for installing python packages on machines where you do not have write access to the site-packages directory.

Note

Example of conflicting packages You have already installed Zope 3.1 for a previous development task. This was installed system wide and has placed a number of packages in your site-packges directory. z3ext currently requires Zope 3.4. Running z3extproject produces an error and aborts it’s process. Virtualenv provides a fix by allowing you to use your Python installation without the packages installed in the default site-packages directory.

To set up a virtualenv to install z3extproject within, first ensure that setuptools is installed.

Next you should install the virtualenv package. To install the virtualenv package into your setuptools-enabled Python interpreter, use the easy_install command.

$ easy_install virtualenv

This command should succeed, and tell you that the virtualenv package is now installed. If it fails due to permission errors, you may need to install it as your system’s administrative user. For example:

$ sudo easy_install virtualenv

Creating the Virtual Python Environment

Once the virtualenv package is installed in your Python, you can actually create a virtual environment. To do so, invoke the following:

1
2
3
$ virtualenv --no-site-packages virtualz3ext
New python executable in virtualz3ext/bin/python
Installing setuptools.............done.

Warning

Using --no-site-packages when generating your virtualenv is very important. This flag provides the necessary isolation for running the set of packages required by z3ext. If you do not specify --no-site-packages, it’s possible that z3extproject will not install properly into the virtualenv, or, even if it does, may not run properly, depending on the packages you’ve already got installed into your Python’s “main” site-packages dir.

Warning

If you’re on UNIX, do not use sudo to run the virtualenv script. It’s perfectly acceptable (and desirable) to create a virtualenv as a normal user.

You should perform any following commands that mention a “bin” directory from within the virtualz3ext virtualenv dir.

Installing z3extproject Into the Virtual Python Environment

After you’ve got your virtualz3ext virtualenv installed, you may install z3extproject itself using the following commands from within the virtualenv (virtualz3ext) directory:

1
$ bin/easy_install z3extproject

This command will take longer than the previous ones to complete, as it downloads and installs a number of dependencies.

Installing z3extproject on a Windows System

  1. Install, or find Python 2.5 for your system.

  2. Install the Python for Windows extensions. Make sure to pick the right download for Python 2.5 and install it using the same Python installation from the previous step.

  3. Install latest setuptools into the Python you obtained/installed/found in the step above: download ez_setup.py and run it using the python interpreter of your Python 2.5 installation using a command prompt:

    c:\> c:\Python25\python ez_setup.py
    
  4. Use that Python’s bin/easy_install to install virtualenv:

    c:\> c:\Python25\Scripts\easy_install virtualenv
    
  5. Use that Python’s virtualenv to make a workspace:

    c:\> c:\Python25\Scripts\virtualenv --no-site-packages virtualz3ext
    
  6. Switch to the virtualz3ext directory:

    c:\> cd virtualz3ext
    
  7. (Optional) Consider using bin\activate.bat to make your shell environment wired to use the virtualenv.

  8. Use easy_install to install z3extproject:

    c:\virtualz3ext> Scripts\easy_install z3extproject