Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a python application, it can run on Python >= 2.6 and it's architecture independant.

I need the rpm package of this application to be installed on Fedora 14 (python 2.7) and Centos 6.2 (python 2.6).

I currently use mock to build one rpm package for each "flavour" and it works well. I apparently can't install the Centos compiled rpm on Fedora.

It gives me this error message :

error: Failed dependencies:
    python(abi) = 2.6 is needed by myapp-0.9.el6.noarch

Here is the relevant part of my .spec file :

%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name:           myapp
Version:        #VERSION#
Release:        #RELEASE#%{dist}
Summary:        myapp

Group:          Development/Languages
License:        Apache v2
Source0:        %{name}-%{version}-#RELEASE#.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch

BuildRequires: python-devel
BuildRequires: python-setuptools


%setup -c

%{__python} build

%{__rm} -rf %{buildroot}

%{__python} install -O1 --skip-build --root %{buildroot}

Do I really have to use mock and build 2 rpms or is there another way to create a single generic 2.x rpm package ?

share|improve this question
So what happens when you ''rpm --install yourpkg.rpm'' on CentOS? – Alien Life Form Jan 10 '12 at 15:50
It says that python(abi) = 2.6 is needed if I try to install the rpm on a system with python 2.7 installed. I'm updating the main post, thanks for the input. – RaphDG Jan 11 '12 at 9:21
I do not know about mock, but other tools I used gave you the option to drop bogus requirements such as this one. – Alien Life Form Jan 11 '12 at 17:36
up vote 1 down vote accepted

The Python files get byte compiled at build time, which is why they require a specific Python version in order to be run. The Right Way is to have separate packages, but it should be possible to write a specfile which only installs the .py source files and therefore doesn't require a specific Python version. You will probably have to handle putting the files in all the /usr/lib/python2.X/site-packages directories you care about though.

share|improve this answer

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.