Search code examples
pythondjangovirtualenvbuildout

How to make sure buildout doesn't use the already installed packages?


I am trying to switch fully to buildout - but our development environment already has lot of stuff installed in /usr/lib/pythonxx/

How can I make sure that buildout doesn't use the libraries installed on the system already - eventually without virtualenv ?

For example - how to avoid this behavior ? :

> cat buildout.cfg
[buildout]
parts = django

[django]
recipe = zc.recipe.egg
eggs = django
interpreter = django

>bin/django 

>>> import django
>>> django
<module 'django' from '/usr/lib/python2.6/site-packages/django/__init__.pyc'>
>>> 

Is there anyway to force buildout NOT to use the eggs installed in /usr/lib/python2.6 ?


Solution

  • You can tell buildout if you want to use site-pakages or not with one of these two directives: include-site-packages and allowed-eggs-from-site-packages

    From buildout documentation:

    You can then use include-site-packages = false and exec-sitecustomize = false buildout options to eliminate access to your Python's site packages and not execute its sitecustomize file, if it exists, respectively.

    Alternately, you can use the allowed-eggs-from-site-packages buildout option as a glob-aware whitelist of eggs that may come from site-packages. This value defaults to "*", accepting all eggs.