Unable to install psycopg2 because of dependancy errors in libpq-dev

1.3k Views Asked by At

I have been trying to install psycopg2 for use in a virtualenv. I managed to find that it depended on libpq-dev (because pip give me a Error: pg_config executable not found. error) which could be install using apt-get install libpq-dev.

However all of my attempts to install libpq-dev have resulted in the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:  
 libpq-dev : Depends: libkrb5-dev but it is not going to be installed
E: Broken packages

Can anyone work out how to fix this?

sources.list

# deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official amd64 NETINST Binary-1 20110320-15:00]/ squeeze main

#deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official amd64 NETINST Binary-1 20110320-15:00]/ squeeze main

deb http://ftp.us.debian.org/debian/ squeeze main
deb-src http://ftp.us.debian.org/debian/ squeeze main

deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main

# squeeze-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ squeeze-updates main
deb-src http://ftp.us.debian.org/debian/ squeeze-updates main

# Backports repository
deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free

# RabitMq
deb http://www.rabbitmq.com/debian/ testing main
1

There are 1 best solutions below

1
On BEST ANSWER

Try adding "contrib non-free" to every source. I think it's because those packages are not listed in the sources you have in sources.list. Try to change every line like this example:

deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free

deb http://ftp.us.debian.org/debian/ squeeze-updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ squeeze-updates main contrib non-free

That worked for me. I hope it works for you too...

If that does not help you, you can try with this. It seems that it works if you specify the packet version you want to install, like this:

apt-get install libpq-dev=8.4.5-2~bpo50+1

Let me know if something of this worked! Best wishes!