无法在 Ubuntu 16.04 上安装 Cassandra

无法在 Ubuntu 16.04 上安装 Cassandra

安装 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)

我无法清除 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$ 

我卡住了,无法安装任何东西,甚至无法清理当前安装。任何帮助都将不胜感激。

答案1

这是存储库冲突的问题。我有一些存储库指向 Ubuntu 12.04 (Precise)。根据此答案https://askubuntu.com/a/260695/108492

一旦我删除它们并运行

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

效果很好

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) ...

一旦依赖关系得到解决,此后的 cassandra 安装也能正常工作。

这是安装成功后的apt-cache策略

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

相关内容