Saturday, July 28, 2018

Unable to install python-dev on Ubuntu 16.04 LTS using aptitude and apt-get



I am trying to install python-dev on a Ubuntu 16.04 LTS (64 bit) guest running on a Windows host. I tried installing using apt-get and then through aptitude, but I seem to be running into errors.



~$sudo aptitude install python-dev



gives,



The following NEW packages will be installed:
libexpat1-dev{ab} libpython-dev{a} libpython2.7-dev{ab} python-dev python2.7-dev{ab}
0 packages upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 28.2 MB of archives. After unpacking 42.1 MB will be used.
The following packages have unmet dependencies:
python2.7-dev : Depends: python2.7 (= 2.7.11-7ubuntu1) but 2.7.12-1~16.04 is installed.

Depends: libpython2.7 (= 2.7.11-7ubuntu1) but 2.7.12-1~16.04 is installed.
libexpat1-dev : Depends: libexpat1 (= 2.1.0-7) but 2.1.0-7ubuntu0.16.04.2 is installed.
libpython2.7-dev : Depends: libpython2.7-stdlib (= 2.7.11-7ubuntu1) but 2.7.12-1~16.04 is installed.
Depends: libpython2.7 (= 2.7.11-7ubuntu1) but 2.7.12-1~16.04 is installed.
open: 20; closed: 1293; defer: 6; conflict: 6 o
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1) libexpat1-dev [Not Installed]
2) libpython-dev [Not Installed]

3) libpython2.7-dev [Not Installed]
4) python-dev [Not Installed]
5) python2.7-dev [Not Installed]



Accept this solution? [Y/n/q/?]


as the output. Whereas,




~$sudo apt-get install python-dev


gives,



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:
python-dev : Depends: libpython-dev (= 2.7.11-1) but it is not going to be installed
Depends: python2.7-dev (>= 2.7.11-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.



I ran sudo aptitude update and sudo aptitude upgrade, but that doesn't solve the problem.



In addition, I ran the steps given in the following links:





but nothing seems to work.



From aptitude's message, I think the dependencies installed on my system are of a higher version than what are required by the package (e.g., one message saysDepends: libpython2.7 (= 2.7.11-7ubuntu1) but 2.7.12-1~16.04 is installed.).




I am guessing my options are either to,




  • uninstall the existing packages (which I'd rather not), or

  • add a more updated PPA for Python-stuff.



My current repositories are:




~$egrep -v '^#|^ *$' /etc/apt/sources.list /etc/apt/sources.list.d/*
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse


Any ideas how I can install python-dev?



Thanks in advance!




One of my fresh installs have these repositories. You appear to be missing some update repositories.



I placed * stars at the ones I don't see from your list.



apollo@apollo:~$ egrep -v '^#|^ *$' /etc/apt/sources.list /etc/apt/sources.list.d/*
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
* /etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
* /etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse

* /etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
* /etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
* /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security main restricted
* /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security universe
* /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu xenial-security multiverse
grep: /etc/apt/sources.list.d/*: No such file or directory
apollo@apollo:~$


Try at least adding the update repositories... then run:




$ sudo apt update
$ sudo apt upgrade

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...