Contents
TurboGears strongly relies on setuptools for its installation and tracking of dependencies. Although setuptools is not included in the standard Python distribution, it is installed by default on many Linux distributions and, if you do not have it yet, can easily be downloaded and installed via the ez_setup.py script.
Note: All commands given below should be run from the command line. The $ at the start of the command line examples denotes the shell prompt. You do not need to enter this. Parts of the given commands in square brackets ([]) are optional and only needed in some situations.
For example, when installing on Unix-like systems as a normal user, you normally need to prefix commands with sudo to run the installation with root privileges.
Important
If you experience problems with the TurboGears download or installation, please write to the mailing list where the community can help you. When you have found a solution for your problem and you think it may be useful for others as well, you can open a documentation ticket.
virtualenv is a tool to create isolated Python environments. An environment has its own installation directories and doesn’t share libraries with other virtualenv environments (and optionally doesn’t use the globally installed libraries either). We can employ this to create a TurboGears environment and tell easy_install to use it as the install location with only a few commands:
Make sure, you have the Python setuptools installed. If you already have the easy_install program, you’re ok. If not:
Download ez_setup.py.
Run it with:
$ [sudo] python ez_setup.py
Install virtualenv from the Cheeseshop:
$ [sudo] easy_install virtualenv
Create & activate a new environment:
$ virtualenv --no-site-packages </path/to/new/environment>
$ source </path/to/new/environment>/bin/activate
Install TurboGears via easy_install:
$ easy_install -i http://www.turbogears.org/1.1/downloads/current/index TurboGears
Now, every time you open a new terminal session to work with the new environment, you need to activate it by running the source command given above. You can create as many virtual environments as you like and install different versions of TurboGears or other Python packages in them and they won’t affect each other.
Note
The --no-site-packages option to virtualenv specifies that in your environment there is no access to the modules installed in the system-wide Python site-packages directorie(s). This is normally recommended, since this prevents problems due to dependency interferences with packages installed there. But if you need access to some packages there, e.g. a system-wide installation of a Python database module, you may need to leave this option out. For more information see the virtualenv documentation.
There are only two steps necessary to install TurboGears, if you already have Python installed and you are ok with installing TurboGears into the system-wide Python site-packages directory. If you don’t have Python installed on your system (or are not sure about it), please visit the Python website.
Download the tgsetup.py script.
Run the script from the command-line:
$ [sudo] python tgsetup.py
We strongly suggest that you also refer to the system-specific installation instructions for details.
Note
The recommended Python version to use with TurboGears currently is 2.5.x, but we still support Python 2.4.x. Python 2.6.x is supported from TurboGears version 1.0.9 and 1.1 onwards.
TurboGears does not support Python 3.x yet.
After installing TurboGears you probably also want to install at least one of the object-relational mappers, SQLObject or SQLAlchemy.
You can issue one or both of the following commands to install SQLObject and/or SQLAlchemy:
$ easy_install SQLAlchemy
resp.:
$ easy_install SQLObject
Installing an older version of TurboGears is possible, too. To install a specific version of TurboGears run a command line similar to this one:
$ easy_install -i http://www.turbogears.org/1.1/downloads/1.1.x/index TurboGears==1.1.x
Replace 1.1.x with the number of the TurboGears version which you want to install. This form requires setuptools to be present on your machine. If you don’t have setuptools yet, download and run ez_setup.py to install it:
$ wget http://peak.telecommunity.com/dist/ez_setup.py
$ python ez_setup.py