graphite / latest / install-virtualenv.html

Installing in Virtualenv

Virtualenv provides an isolated Python environment to run Graphite in.

Installing in the Default Location

To install Graphite in the default location, /opt/graphite/, create a virtualenv in /opt/graphite and activate it:

virtualenv /opt/graphite
source /opt/graphite/bin/activate

Once the virtualenv is activated, Graphite and Carbon can be installed from source or via pip. Note that dependencies will need to be installed while the virtualenv is activated unless –system-site-packages is specified at virtualenv creation time.

Installing in a Custom Location

To install from source activate the virtualenv and see the instructions for graphite-web and carbon

Running Carbon Within Virtualenv

Carbon may be run within Virtualenv by activating virtualenv before Carbon is started

Running Graphite-web Within Virtualenv

Running Django’s django-admin.py within a virtualenv requires using the full path of the virtualenv:

/path/to/env/bin/django-admin.py <command> --settings=graphite.settings

The method of running Graphite-web within Virtualenv depends on the WSGI server used:

Apache mod_wsgi

Note

The version Python used to compile mod_wsgi must match the Python installed in the virtualenv (generally the system Python)

To the Apache mod_wsgi config, add the root of the virtualenv as WSGIPythonHome, /opt/graphite in this example:

WSGIPythonHome /opt/graphite

and add the virtualenv’s python site-packages to the graphite.wsgi file, python 2.6 in /opt/graphite in this example:

site.addsitedir('/opt/graphite/lib/python2.6/site-packages')

See the mod_wsgi documentation on Virtual Environments <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments> for more details.

Gunicorn

Ensure Gunicorn is installed in the activated virtualenv and execute as normal. If gunicorn is installed system-wide, it may be necessary to execute it from the virtualenv’s bin path

uWSGI

Execute uWSGI using the -H option to specify the virtualenv root. See the uWSGI documentation on virtualenv for more details.

© 2008–2012 Chris Davis
© 2011–2016 The Graphite Project
Licensed under the Apache License, Version 2.0.
https://graphite.readthedocs.io/en/latest/install-virtualenv.html