Last Updated: December 06, 2016
· banjer

Using fpm to convert a python package to an rpm

Building rpms sucks. Fortunately, Jordan Sissell has written an amazing tool called fpm that can take several different types of sources and package them up into an rpm, deb, etc... I've been using it to put python packages into rpms to distribute them to hosts via puppet.

Install fpm ruby gem

gem install fpm

There is excellent documentation for converting python packages with fpm on the github page, but I have multiple versions of Python on my system, and the docs on using a non-standard python did not quite work for me, so here it is.

Example: package the requests module with non-standard python and easy_install location:

fpm -s python -t rpm --python-bin python2.7 --python-easyinstall easy_install-2.7 requests

fpm will download the requests module for you using the specified easy_install version you supplied and package it up for you.

2 Responses
Add your response

Nice one, saved lot of time.

over 1 year ago ·

This doesn't work when package has dependencies.

over 1 year ago ·