Edgewall Software

Version 282 (modified by trac@…, 10 years ago) ( diff )

The installers do not setup any of the environment needed for a successful installation.

Please Note: These instructions are for Trac 0.11

The instructions for Trac 0.10 can be found at the 0.10/TracOnWindows page.

The installer instructions are incomplete, and do not provide a working solution. Follow the manual installation instructions.

Trac On Windows

The installation of Trac on Windows is now much simpler, due to the dropping of ClearSilver as the primary template engine in favor of Genshi (Clearsilver is still optionally supported in case you need to use a plugin that requires it).

If furthermore you don't need to interface with Subversion, then all you need besides are a few Python packages. It doesn't hurt to have an svn client at hand for checking out the latest "trunk" version of some packages, like Trac itself or Genshi.

Installing Python on Windows

Installation package for Python adds it to App Paths, so that Python executable could be run from any directory in the command line. In most cases you don't need to add Python to PATH manually.

Python 2.5

Although Trac runs on Python 2.4 it is better to get more recent stable Python version if you don't have any installed.

Simply download and install the appropriate .msi for your Python platform:

Notes regarding 64 bit Python:

  • SetupTools does not yet provide an install that works with 64-bit Python, it's nevertheless possible to use the easy-install-script.py (see http://bugs.python.org/setuptools/issue2).
  • The Subversion project does not provide amd64 or ia64 setup executables, so if you want to use Subversion integration, you'll need to either compile the bindings yourself, or use the x86 version of Python.
  • It's generally hard to find pre-compiled extensions, so you most often have to compile them yourself (e.g. for Genshi, Mercurial, the bindings for the DB backends).

That being said, it's perfectly possible to run Trac for Windows/x64 (XP or Vista).

Python 2.6

Python-2.6.1.msi

Method 1: Using Installers

You need to download and install the following packages, pick the link appropriate to your Python version:

Mandatory Packages Installers
SetupTools setuptools-0.6c7.win32-py2.X.exe (2.5, 2.4, 2.3) (check here for latest)
As yet there's no installer for Python 2.6. Use the manual method below.
Genshi 0.5 Genshi-0.5.win32-py2.X.exe (2.5, 2.4, 2.3)
Genshi-0.5.1.win32-py2.X.exe (2.5, 2.4, 2.3) (check here for latest)
Trac 0.11 Trac-0.11.win32.exe (works for Python 2.3, 2.4 and 2.5)
Trac-0.11.2.1.win32.exe (check here for latest)


Optional Packages Installers (see notes below)
PySqlite pysqlite-2.4.0.win32-py2.X.exe (2.5, 2.4, 2.3) (1)
Subversion svn-python-1.4.6.win32-py2.X.exe - (2.5, 2.4, 2.3) (2)
svn-python-1.6.1.win32-py2.X.exe - (2.5)
ClearSilver clearsilver-0.9.14.win32-py2.X.exe - (2.5, 2.4, 2.3) (3)

Notes:

  1. Pysqlite
    • If you're using Python 2.5, Trac is able to use the built-in sqlite3 module (same as Pysqlite 2.3.2), so you don't necessarily need to install that package.
    • If you plan to use another database than SQLite, installing Pysqlite is of course not needed. See the TracOnWindows/Advanced instructions for other options.

  1. Subversion
    • You don't necessarily need Subversion. You can use Trac with other versioning system backends or none at all.
    • VisualSVN is an easy solution for Windows users who want to use Subversion integration.
    • If you need Subversion, the above links should be fine, unless you need to use Trac within Apache 2.2. In that case you need Apache 2.2 compatible binaries. But beware, this is a tricky install, as it seems that there exist various incompatibilities between the various released binaries (in particular, see ticket:6739#comment:9).
    • Try svn-python-1.5.2.win32-py2.5.exe if you have Subversion 1.5 and see the error like "Expected FS format '2'; found format '3'", 160043
  1. Clearsilver You only need Clearsilver if you're using a plugin that was not yet ported to Genshi.

Method 2: Manual Installation

This method is about using easy_install (from Setuptools) at the command line. Ideally, once everything will have settle down, this will be a matter of doing easy_install Trac. Don't try that yet, though, rather go through the following steps. Seems to be working for Trac and Genshi…

Windows command line

You'll need to open a Windows command line to install some of the necessary software:

  1. Click "Start" > "Run…" (or press Win+R)
  2. Type "cmd" and click "Ok" - this opens the Windows command console
  3. Type "cd c:\Python26" (substitute your python folder)

Tip: On Vista, hold shift key, right click on desired folder, and choose 'Open Command Window Here'. You can do the same in Windows XP with PowerToys installed.

Setuptools

Setuptools makes installation of Python software easier by automatically downloading and installing Python packages from the internet. It is also used to find and load Trac's plugins.

Download the setuptools installer: ez_setup.py

When the download completes double-click the "ez_setup.py" file from your download folder to install setuptools.

That didn't work for me. I found this method on StackOverflow:

Now change to the new scripts directory in your command prompt (substitute your python folder):

cd \Python26\scripts

You should now be in the folder "C:\Python26\Scripts" where you can run the "easy_install" command to install the remaining software.

At this point you should be able to type

easy_install Trac

to install both the latest Trac and Genshi releases.

Installing Genshi

Download the zip package:

Unzip to a folder and then from that folder run python setup.py install in a command window. (Make sure you have added the Python install path (e.g. C:\Program Files\Python25) to your system PATH variable. You can do this by right clicking on My Computer, clicking on Properties, selecting the Advanced tab, clicking the Environment Variables button, scrolling down the second list window until you see the 'Path' variable, then editing the string to add the Python install path. Then start command line for Genshi installation.)

Install PySQLite

Obsolete: the Trac install includes SQLite

Install the PySqlite database driver:

easy_install pysqlite

If you want to use another database than SQLite, you need to read the TracOnWindows/Advanced instructions.

Note: When installing PySQLite this way, you may see the following error:

Error: Setup script exited with error: Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed.

If so, try installing PySQLite with the Windows executable installer referenced in the Method 1 above.

When it has finished downloading, double-click on it to run the installer. On the first window of the installation dialog, click Next to begin the installation process.

On the second window, confirm the Python install directory. If you have followed the instructions above, it will be "c:\python24\". The default install directory will show as "c:\python24\Lib\site-packages\". Accept the defaults or change them to match your own directory structure. Click Next to proceed.

The next window in the dialog gives you a chance to cancel or continue. To continue, click Next.

On the next window, the installer shows you installation progress as files are written to the target locations. When the processing is complete, click Finish. If you check the contents of c:\python24\Lib\site-packages\ directory, you should see the directory pysqlite2, which contains the database scripts.

Install Subversion (optional)

Trac can integrate with the Subversion version control software. Follow these steps if you'd like to use Trac with Subversion. You can learn more about how they can integrate from the wiki: TracSubversion.

This document covers using the Subversion command line tools, but you can also use the TortoiseSVN Windows GUI.

Download and run the installer for the Subversion command line tools: svn-1.4.2-setup.exe

The installation begins by displaying a small dialog titled Setup. It asks you whether you wish to continue. Click Yes.

A larger window appears, titled Setup - Subversion. The first window of the dialog says "Welcome to the Subversion Setup Wizard". Click Next. Click "I accept the agreement" and then click Next. On the next window, read the important information and click Next.

Select your destination directory for the Subversion installation. Click Next. You will then have the option of installing a Subversion menu item on the Start Menu, and a selection of places to put Subversion icons. Click Next. Finally you are ready to install. Click Next and the files will be copied to your selected destination. A couple more windows follow the install process, and then you're done.

Go back to your command line to install the Subversion Python library:

easy_install -Z http://subversion.tigris.org/downloads/1.4.5-win32/apache-2.0/svn-python-1.4.5.win32-py2.5.exe

(pick the appropriate download link matching your installed Python version — see the section under Method 1 where the links to svn/python bindings may be more up to date than here.)

Note: the "-Z" option is necessary when installing Subversion so that it is "unzipped". Trac will not be able to access Subversion if it is zipped.

The installation process will begin with "Downloading http://subversion.tigris.org/downloads/svn-python-1.4.2.win32-py2.4.exe" and — if successful — ends with "Processing dependencies for svn-python==1.4.2".

Install ClearSilver (optional)

Install the ClearSilver template language:

easy_install -f http://clearsilver.net/downloads clearsilver==0.9.14

Installing mod_python (optional)

This is needed if you want to use with the Apache HTTP server.

If you are using an Apache server, you will need the latest mod_python for windows, built against Python v2.5. Currently version 3.3.1 is available at the Apache website (click on "Other Files" and surf to modpython/win/3.3.1/). However, you can also get other versions here, courtesy of a very kind and wise gentleman called Nicolas Lehuen. See TracModPython for instructions.

An alternative would be to use mod_wsgi (download mod_wsgi.so 2.3 for several Apache and Python combinations). See TracModWSGI for instructions.

Installing plugins

There's no need to install the WebAdmin plugin, as it has now been integrated in Trac proper. Quite to the contrary, you should remove it if you're upgrading (it will be automatically disable though, so don't worry).

See TracPlugins for details about plugin installation.

For example, you can install the SpamFilter plugin. For that, you can grab them directly from the repository, and install it the same way you did for Trac:

> cd C:\src
> svn checkout http://svn.edgewall.org/repos/trac/sandbox/spam-filter 
> cd spam-filter
> python setup.py install

Note if you catch an error:"ImportError: No module named setuptools" please download http://peak.telecommunity.com/dist/ez_setup.py and install the setuptools.

If for some reason the above step fails, either because there's no package for the Windows platform you're using or the setuptools don't manage to read information from your svn working copy (if you used Subversion 1.4 for doing the checkout), you'll probably need to install first a recent setuptools package, itself available from http://svn.python.org/projects/sandbox/trunk/setuptools. Version 0.7a1 (r51948) from the repository worked for me.

Installing Trac

You simply need the latest trunk (0.11dev) - to get this type the following in the command window. (Make sure you have added the Python install path (e.g. C:\Program Files\Python25) to your system PATH variable. You can do this by right clicking on My Computer, clicking on Properties, selecting the Advanced tab, clicking the Environment Variables button, scrolling down the second list window until you see the 'Path' variable, then editing the string to add the Python install path). Make sure you have setuptools installed before proceed.

> cd C:\src
> svn checkout http://svn.edgewall.org/repos/trac/trunk
> cd trunk
> python setup.py install

Then, have a look at how to setup the TracEnvironment, use the TracStandalone web front-end and you're set.

More specifically, do this to get 0.11 with webadmin up and running:

Create an administrator user (uses the script described lower in this page)

python trac-digest.py -u adm -p adm >> c:\digest.txt

Give that user all permissions

trac-admin c:\myproj permission add adm TRAC_ADMIN

Now…

tracd -p 8000 --auth=myproj,c:\digest.txt,trac c:\myproj

And you'll be able to see the Admin tab if you log in with 'adm'

Getting Started

Ok, now that Trac and all its requirements have been installed you can create your first project and try it out.

This example will create the projects in "C:\projects". This is a good default location, but you can put them in another drive or folder if you prefer.

Back to the command line:

md c:\projects
cd c:\projects

Optional: if you're using Trac with Subversion you can create a new repository for your source code:

md c:\projects\svn
svnadmin create c:\projects\svn\my-project

This step causes Subversion to create a subdirectory (c:\projects\svn\my-project) containing the basics of a Subversion project.

Initialize a new Trac project environment:

First go to the 'Scripts' folder in your Python install directory (e.g. "\Python25\Scripts"), and add the '.py' extension onto the files 'tracd' and 'trac-admin' if this is missing. Then, type the following at the command line:

md c:\projects\trac
c:\Python25\Scripts\trac-admin.exe c:\projects\trac\my-project initenv

Follow the interactive prompts to input information about your project. If you are unsure what to put you can simply press "Enter" to accept the default value.

Project Name [My Project]> 

Database connecting string [sqlite:db/trac.db]>

Repository type [svn]>

Path to repository [/path/to/repos]>

Template directory [C:\Python25\share\trac\templates]>

You may require to specify the Database connection string as db\\trac.db After this response, the script will say "Creating and Initializing Project". A large number of messages will scroll, finishing with "Congratulations!".

Note for Subversion users: when asked for the "Path to repository" input the folder of the repository you just created:

Path to repository [/path/to/repos]> c:/projects/svn/my-project

Note: be sure to include the full path, including the drive letter, and use forward slashes.

Try it out

Trac includes a standalone webserver called tracd. You can also use Trac with other webservers, but you should first try tracd to make sure everything's set up and working correctly:

From the command line, and in the [Python Install]\Scripts directory:

tracd-script.py -p 8000 c:\projects\trac\my-project

This exits with the following error on my system:

Usage: tracd-script.py [options] [projenv] …

tracd-script.py: error: either the —env-parent-dir option or at least one environment must be specified

The following works, though:

tracd.exe -p 8000 c:\projects\trac\my-project

—- dummzeuch

Open your browser to http://localhost:8000 to test out your new Trac project. You should see the title "Welcome to Trac 0.11" in your browser, and in the command window from which you just launched tracd there will be a series of status log messages. These messages will continue to update as you move around the Trac site. When you are done, return to the command window from which you launched tracd and press Ctrl+Break to stop tracd.

Creating authentication with tracd on Windows (Standalone)

If you are running tracd without Apache, you can use this simple Python script to generate your passwords for tracd. Copy the contents below into a new file called 'C:\Python25\scripts\trac-digest.py'.

from optparse import OptionParser
import md5

# build the options
usage = "usage: %prog [options]"
parser = OptionParser(usage=usage)
parser.add_option("-u", "--username",action="store", dest="username", type = "string",
                  help="the username for whom to generate a password")
parser.add_option("-p", "--password",action="store", dest="password", type = "string",
                  help="the password to use")
(options, args) = parser.parse_args()

# check options
if (options.username is None) or (options.password is None):
   parser.error("You must supply both the username and password")
   
# Generate the string to enter into the htdigest file
realm = 'trac'
kd = lambda x: md5.md5(':'.join(x)).hexdigest()
print ':'.join((options.username, realm, kd([options.username, realm, options.password])))

You can create a new password file, or add new users to the file, by executing this command from the command line:

C:\Python25\Scripts\trac-digest.py -u "My User Name" -p my@user@password >> C:\projects\passwords.txt

Then let's add full permission to the id that you created. And you will be able to see more administrator's menu.

C:\Python25\Scripts\trac-admin c:\projects\trac\my-project permission add "My User Name" TRAC_ADMIN

To start tracd with authentication, execute this command from the command line:

C:\Python25\Scripts\tracd-script.py -p 8000 --auth=my-project,C:\projects\passwords.txt,trac c:\projects\trac\my-project

Running port 80 on tracd on Windows (Standalone)

This describes getting IIS out of the way, so you can run tracd on port 80. This assumes Windows Server 2003 SP2 (IIS 6); I just haven't tried it on other versions.

IIS typically listens to port 80 on all IP addresses, whether or not a website is assigned to an IP. This prevents other services from using port 80, including tracd. To get IIS to stop listening to all IP addresses, use httpcfg to tell it specific IP addresses.

Install the Windows Server 2003 SP1 Support Tools.

Normally found on the installation disk. (It originated with SP1, hence its name, even though Windows Server 2003 is now at SP2).
Also found here:
http://www.petri.co.il/download_windows_2003_sp1_support_tools.htm
http://download.microsoft.com/download/3/e/4/3e438f5e-24ef-4637-abd1-981341d349c7/WindowsServer2003-KB892777-SupportTools-x86-ENU.exe

This basically just copies the tools, which are just executables. However, the installer does set Start menu links, which are handy for knowing what's there, so run it. The files end up in:

C:\Program Files\Support Tools\

List IP addresses currently listening: (this will be an empty list to start)

httpcfg query iplisten

Add IP address(es) to listen:

httpcfg set iplisten -i 127.0.0.1      (to keep it listening on localhost; seemed like a good idea)
httpcfg set iplisten -i nnn.nn.n.nnn   (other IIS IP addresses as needed; NOT the one you want for tracd)

Stop and restart http service.
Note the stop and start are different, to stop top-down, and start bottom-up. This is not simply restarting IIS. Sometimes this fails to restart; reboot the server.

net stop http /y
net start w3svc

Run tracd

Include the hostname option, so tracd runs on a specific IP that isn't in the IIS listening list. The IP address worked locally, but a host name seems required for remote access. IIS still seems to check it before passing on it.

tracd -b hostname.domain.com (and other options as needed)

Side notes:
This specific listen list is also needed (and is how I discovered it) for installing different SSL certificates on multiple websites. This frees up the dialog boxes that allow entering a specific IP address for the SSL port 443.

Later, if you add a new IP address and website to IIS, you must add it to this listen list. You'll forget. I don't remember the error message, but I'm sure it's vague, and it will drive you crazy.

There are other toolkits (even though this task boiled down to the one above):

Using SSL with tracd on Windows (Standalone)

(Please fill this section out).

Troubleshooting

pkg_resources.DistributionNotFound: Trac==0.11

You just installed Trac 0.11, now you're trying to use it (e.g. by using tracd.exe fresh from the Scripts/ directory in your Python installation) and you're welcomed by a backtrace featuring the above error…

Chances are that like me you skipped the Genshi installation step, thinking you had a version recent enough (like 0.5dev). But you actually need 0.5 or newer (0.5.1, 0.6dev, etc.), 0.5dev won't work and you'll get the above (a bit misleading) error.

Of course, this problem can only happen when using the binary installer for Trac, it can't happen when you're using easy_install.

Unsupported version control system "svn"

The Subversion library is not installed properly. Be sure you used the "-Z" option with easy_install when installing the Subversion bindings.

Also, ensure you are using forward slashes for the svn repository directory.

Error: Setup script exited with error: Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed.

Note that something similar is probably happens between the apache 2.2 httpd.exe, python.exe, mod_python.so and the Subversion bindings. See #6739 and #5752, in particular comment:22:ticket:5752.

From http://www.mail-archive.com/trac-dev@googlegroups.com/msg00997.html

The problem is that the pre-built Windows binaries for PySQLite are currently not detected by setuptools, so it is trying to download and compile the sources which requires a build environment. Unfortunately

this is not particularly common or easy on Windows. I have reported the problem to the PySQLite developers, so hopefully they will addresss this soon: http://initd.org/tracker/pysqlite/ticket/191

It appears you can successfully install Trac by following a combination of Method 2: Manual Installation and Method 1: Using Installers, above. The critical step for installing PySQLite is to use the self-installing EXE version, which does not trigger the bogus compile step. As noted above, download and execute the appropriate file:

PySqlite pysqlite-2.3.2.win32-py2.4.exe (or the Python 2.3 version)

See also: the TracOnWindows/Advanced instructions, TracOnWindows/Rewrite for discussing improvements to this page, 0.10/TracOnWindows and Trac0.9/TracOnWindows for the previous version of this document. Installing Trac on Windows

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.