Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I build my rpms as such:

rpmbuild -bb SPECS/python.spec

With the following spec file:

%define _topdir /home/rpmbuild/python
%define name Python
%define release 1
%define version 2.6.4
%define buildroot %{_topdir}/%{name}-%{version}-root

BuildRoot: %{buildroot}
Summary: python
License: GPL
Name: %{name}
Version: %{version}
Release: %{release}
Source: %{name}-%{version}.tar.bz2
Group: Python

Python, compiled by Jon Haddad for CentOS

%setup -q

./configure --prefix=/usr/local



Here's the error I get when I try to install:

[root@puppet rpms]# rpm -ivh Python-2.6.4-1.x86_64.rpm error: Failed dependencies: /home/rpmbuild/python/Python-2.6.4-root/usr/bin/python2.6 is needed by Python-2.6.4-1.x86_64 /usr/local/bin/python is needed by Python-2.6.4-1.x86_64 /usr/local/bin/python2.6 is needed by Python-2.6.4-1.x86_64

I really don't have any experience building my own RPMs, but I'm trying to set up a puppet server, and it seems to favor install via RPM. I need to use versions of software that aren't available as RPM yet on CentOS.

The RPM file is created in the RPM directory - but I have no idea what the error means.

Any ideas? Thanks in advance.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It helps to understand a little about how RPM works here.

RPM will be automatically adding requirements for particular classifications of file that it knows about (eg ELF shared libraries, #! scripts, etc):

What is happening here is that some of the contents of the payload have been picked up with having requirements that are not packaged:


We can verify this by running rpmbuild -bi Python.spec to run the build up to the install stage. Based on the information supplied above you could search for files:

find /home/rpmbuild/python/Python-2.6.4-root/ -type f -exec grep \ /home/rpmbuild/python/Python-2.6.4-root/usr/bin/python2.6

I'd say you're looking at:

/home/rpmbuild/Python-2.6.4-root/usr/bin/python2.6-config for the the file that has a shebang that refers to the full buildroot and a bunch of scripts that refer to /usr/local/bin/python2.6

RPM isn't doing anything wrong here, and the details of the right way to fix this up will often be specific to the build of the package you're building.

One approach to fixing this would be to set AutoProvReq: no in the preamble of the SPEC file, eg directly after Group: Python. This should give you an installable RPM but you could argue that it's not taking full advantage of RPM's dependency model and you'd have incorrect paths in some of your Python package files.

Lets specifically look at the Python build and try and understand what we could do to fix this in a more comprehensive way.

Your %install section uses the macro %makeinstall which expands by default as:

[pnasrat@centos5 ~]$ rpm -E '%makeinstall'

  /usr/bin/make \
    prefix=/usr \
    exec_prefix=/usr \
    bindir=/usr/bin \
    sbindir=/usr/sbin \
    sysconfdir=/etc \
    datadir=/usr/share \
    includedir=/usr/include \
    libdir=/usr/lib64 \
    libexecdir=/usr/libexec \
    localstatedir=/var \
    sharedstatedir=/usr/com \
    mandir=/usr/share/man \
    infodir=/usr/share/info \

For reference I tend to consult the upstream Fedora SPEC, which is much more complicated but can be made to build (with some modification and a patch for autotools versions IIRC) a parallel python26 package. I'm not going to go into the detail of that right now but if we look at how they install the key line is:

make install DESTDIR=%{buildroot}

I'd strongly recommend doing that rather than disabling AutoProvReq. As Python is a libtool based build that is probably better than the %makeinstall macro as you've already configured prefix. That seems to do the right thing by inspecting here. Note, if you are rebuilding with this change you'll also want to add:


And want a similar rm line at the beginning of the %install section. This all seems to work for me:

[pnasrat@centos5 RPMS]$ rpm --test -ivh x86_64/Python-2.6.4-1.x86_64.rpm 
Preparing...                ########################################### [100%]

It might well be worth using a python2.6 package provided elsewhere, I believe IUSCommunity provides packages, as documented here - These are probably much closer to the fedora packages.

share|improve this answer
Adding the 2 rm lines and changing the %makeinstall worked perfectly. Thanks paul! Even if there's Python packages for Centos, I'm sure there's other packages I'll need that aren't, so this is more of a crash course in building RPMs. – Jon Haddad Feb 5 '10 at 18:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.