Ubuntu 18.04.2 install python2.7, unmet dependency
9,467
you just have to uninstall already installed python2 packages with this :
sudo apt purge libpython2*
Then install python2 :
sudo apt install python
Related videos on Youtube
Author by
Bai Yang
Updated on September 18, 2022Comments
-
Bai Yang over 1 year
I cannot install python2 on my ubuntu 18.04.2, below are what I did:
bo@ubuntu18:~$ sudo apt install python 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 resolve the situation: The following packages have unmet dependencies: python : PreDepends: python-minimal (= 2.7.15~rc1-1) but it is not going to be installed Depends: python2.7 (>= 2.7.15~rc1-1~) but it is not going to be installed E: Unable to correct problems, you have held broken packages.
So step by step, I found the source problem is that I cannot install libpython2.7 on my laptop:
The following packages have unmet dependencies: python2.7-minimal : Depends: libpython2.7-minimal (= 2.7.15~rc1-1) but 2.7.15~rc1-1ubuntu0.1 is to be installed Recommends: python2.7 but it is not going to be installed E: Unable to correct problems, you have held broken packages.
Does anyone know how to resolve this problem?
The output of
apt-cache policy python libpython2.7-minimal
bo@ubuntu18:~$ apt-cache policy python libpython2.7-minimal python: Installed: (none) Candidate: 2.7.15~rc1-1 Version table: 2.7.15~rc1-1 500 500 http://mirror.clibre.uqam.ca/ubuntu bionic/main amd64 Packages libpython2.7-minimal: Installed: 2.7.15~rc1-1ubuntu0.1 Candidate: 2.7.15~rc1-1ubuntu0.1 Version table: *** 2.7.15~rc1-1ubuntu0.1 100 100 /var/lib/dpkg/status 2.7.15~rc1-1 500 500 http://mirror.clibre.uqam.ca/ubuntu bionic/main amd64 Packages
Then I changed a software source and updated something. It works.
bo@ubuntu18:~$ apt-cache policy python libpython2.7-minimal python: Installed: 2.7.15~rc1-1 Candidate: 2.7.15~rc1-1 Version table: *** 2.7.15~rc1-1 500 500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages 100 /var/lib/dpkg/status libpython2.7-minimal: Installed: 2.7.15-4ubuntu4~18.04.1 Candidate: 2.7.15-4ubuntu4~18.04.1 Version table: *** 2.7.15-4ubuntu4~18.04.1 500 500 http://ca.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages 500 http://ca.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages 100 /var/lib/dpkg/status 2.7.15~rc1-1 500 500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
-
user535733 over 4 yearsLooks like you are trying to install the package from some non-Ubuntu source, or you tried (and perhaps failed) to install and didn't clean up afterward. Use
apt-cache policy libpython2.7-minimal
to determine which non-Ubuntu or obsolete source the 2.7.15~rc1-1ubuntu0.1 version is coming from, then disable that source, then runsudo apt update
to refresh your package database from the remaining (valid) sources. -
N0rbert over 4 yearsPlease add output of
apt-cache policy python libpython2.7-minimal
to the question. -
Bai Yang over 4 yearsI have added the
apt-cache policy python libpython2.7-minimal
's output. @user535733 @N0rbert
-