1

Running into this error while installing cassandra

Unpacking python-setuptools (30.3.0) ...
dpkg: error processing archive /var/cache/apt/archives/python-setuptools_30.3.0_all.deb (--unpack):
 trying to overwrite '/usr/lib/python2.7/dist-packages/pkg_resources/extern/__init__.py', which is also in package python-pkg-resources 20.7.0-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/python-setuptools_30.3.0_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I'm unable to purge python-pkg-resources

You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 python-aptdaemon : Depends: python-pkg-resources but it is not going to be installed
 python-chardet : Depends: python-pkg-resources but it is not going to be installed
 python-cryptography : Depends: python-setuptools (>= 11.3) but it is not going to be installed
 python-zope.interface : Depends: python-setuptools but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
aditya@konoha2:/var/lib/dpkg/info$ 

I'm stuck, unable to install anything or even clean the current installation. Any help will be appreciated.

karel
  • 114,770
Aditya
  • 121
  • 4
  • Found the problem. There was a repo pointing to precise which was causing the conflict – Aditya Mar 06 '17 at 15:40
  • Added the answer. I tried running apt-cache policy earlier but could not make sense of the output. Unfortunately, i didn't save it. I've attached the fresh of apt-cache policy just for reference. Also, upvoted the comment, i'll try that the next time i run into such an issue – Aditya Mar 06 '17 at 15:45

1 Answers1

1

This was a problem of conflicting repositories. I had some repositories pointing to Ubuntu 12.04 (Precise). Based on this answer https://askubuntu.com/a/260695/108492

Once i removed them and ran

sudo apt-get update
sudo apt-get -f install

It worked fine

Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-setuptools all 20.7.0-1 [169 kB]
Fetched 169 kB in 3s (47.0 kB/s)            
(Reading database ... 348605 files and directories currently installed.)
Preparing to unpack .../python-setuptools_20.7.0-1_all.deb ...
Unpacking python-setuptools (20.7.0-1) ...
Setting up python-setuptools (20.7.0-1) ...
Setting up python-cryptography (1.6) ...
Setting up python-zope.interface (4.3.2) ...

The cassandra installation after this also worked fine once the dependency was sorted.

This is the apt-cache policy after the successful installation

sudo apt-cache policy python-setuptools python-pkg-resources
python-setuptools:
  Installed: 20.7.0-1
  Candidate: 20.7.0-1
  Version table:
 *** 20.7.0-1 500
        500 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://in.archive.ubuntu.com/ubuntu xenial/main i386 Packages
        100 /var/lib/dpkg/status
python-pkg-resources:
  Installed: 20.7.0-1
  Candidate: 20.7.0-1
  Version table:
 *** 20.7.0-1 500
        500 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://in.archive.ubuntu.com/ubuntu xenial/main i386 Packages
        100 /var/lib/dpkg/status
Aditya
  • 121
  • 4