Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (54 sloc) 2.97 KB


A cookiecutter template to add easy Debianization to any existing Python project. It creates a self-contained Python virtualenv wrapped into a Debian package (an "omnibus" package, all passengers on board). The packaged virtualenv is kept in sync with the host's interpreter automatically. See spotify/dh-virtualenv for more details.

GroupsApache 2.0 licensed

The similar debianized-pypi-mold creates a project to make a Debian package from any existing PyPI release. It fits when you just want to package a 3rd party release. If you plan to contribute Debian packaging to upstream instead, use this template.


In case you don't have the cookiecutter command line tool yet, here's how to install it.

Using the template

Adding this template to your existing Python project goes like this (make sure you're in the root directory of your project):

dch -r "" # add a proper distro and date to the changelog

It makes sense to git add the created directory directly afterwards, before any generated files are added, that you don't want to have in your repository.

Note that you need to install the usual Debian development tools and dh-virtualenv (at least version 0.8), before you can actually build the DEB package. These incantations will perform that for you:

sudo apt-get install build-essential debhelper devscripts equivs
sudo mk-build-deps --install debian/control

Then, if you have all pre-requisites satisfied, try this:

dpkg-buildpackage -uc -us -b

The resulting package, if all went well, can be found in the parent of your project directory. You can upload it to a Debian package repository via e.g. dput, see here for a hassle-free solution that works with Artifactory and Bintray.


'pkg-resources not found' or similar during virtualenv creation

If you get errors regarding pkg-resources during the virtualenv creation, update your build machine's pip and virtualenv. The versions on many distros are just too old to handle current infrastructure (especially PyPI).

This is the one exception to “never sudo pip”, so go ahead and do this:

sudo pip install -U pip virtualenv

Then try building the package again.

Related Projects

  • make-deb – A simple tool that generates a Debian configuration using dh-virtualenv, based on your setuptools configuration and git history.
You can’t perform that action at this time.