Ubuntu 14.04.3. I can't install python-dev:

yura@ubuntu:~$ sudo apt-get install python-dev
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.5-5ubuntu3) but it is not going to be installed
              Depends: python2.7-dev (>= 2.7.5-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Also:

yura@ubuntu:~$ sudo apt-get install libpython-dev
[sudo] password for yura:
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:
 libpython-dev : Depends: libpython2.7-dev (>= 2.7.5-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
yura@ubuntu:~$ sudo apt-get install libpython2.7-dev
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:
 libpython2.7-dev : Depends: libpython2.7-stdlib (= 2.7.6-8) but 2.7.6-8ubuntu0.2 is to be installed
                    Depends: libpython2.7 (= 2.7.6-8) but 2.7.6-8ubuntu0.2 is to be installed
E: Unable to correct problems, you have held broken packages.
yura@ubuntu:~$ sudo apt-get install libpython2.7-stdlib
Reading package lists... Done
Building dependency tree      
Reading state information... Done
libpython2.7-stdlib is already the newest version.
libpython2.7-stdlib set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
yura@ubuntu:~$ sudo apt-get install libpython2.7-dev
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:
 libpython2.7-dev : Depends: libpython2.7-stdlib (= 2.7.6-8) but 2.7.6-8ubuntu0.2 is to be installed
                    Depends: libpython2.7 (= 2.7.6-8) but 2.7.6-8ubuntu0.2 is to be installed

I have tried this commands, they does not help:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
auso apt-get install -f

When I trying to execute apt-get update, I receive this:

yura@ubuntu:~$ sudo apt-get update
Ign http://us.archive.ubuntu.com trusty InRelease
Get:1 http://us.archive.ubuntu.com precise-updates InRelease [55,7 kB]         
Get:2 http://us.archive.ubuntu.com trusty Release.gpg [933 B]                  
Get:3 http://us.archive.ubuntu.com precise-updates/main i386 Packages [1 045 kB]
Ign http://dl.google.com stable InRelease                                      
Ign http://extras.ubuntu.com trusty InRelease                                  
Get:4 http://dl.google.com stable Release.gpg [181 B]      
Get:5 http://extras.ubuntu.com trusty Release.gpg [72 B]                       
Get:6 http://dl.google.com stable Release [1 189 B]                            
Get:7 http://extras.ubuntu.com trusty Release [11,9 kB]                        
Get:8 http://dl.google.com stable/main amd64 Packages [1 363 B]                
Get:9 http://extras.ubuntu.com trusty/main Sources [14 B]                      
Get:10 http://extras.ubuntu.com trusty/main i386 Packages [14 B]               
Ign http://dl.google.com stable/main Translation-en_US                         
Ign http://dl.google.com stable/main Translation-en        
Ign http://extras.ubuntu.com trusty/main Translation-en_US 
Ign http://extras.ubuntu.com trusty/main Translation-en    
Get:11 http://us.archive.ubuntu.com precise-updates/restricted i386 Packages [16,1 kB]
Get:12 http://us.archive.ubuntu.com precise-updates/main Translation-en [414 kB]
Get:13 http://us.archive.ubuntu.com precise-updates/restricted Translation-en [3 869 B]
Get:14 http://us.archive.ubuntu.com trusty Release [58,5 kB]                 
Get:15 http://us.archive.ubuntu.com trusty/main Sources [1 064 kB]
Get:16 http://us.archive.ubuntu.com trusty/restricted Sources [5 433 B]        
Get:17 http://us.archive.ubuntu.com trusty/universe Sources [6 399 kB]         
Get:18 http://us.archive.ubuntu.com trusty/multiverse Sources [174 kB]         
Get:19 http://us.archive.ubuntu.com trusty/main i386 Packages [1 348 kB]       
Get:20 http://us.archive.ubuntu.com trusty/restricted i386 Packages [13,4 kB]  
Get:21 http://us.archive.ubuntu.com trusty/universe i386 Packages [5 866 kB]   
Get:22 http://us.archive.ubuntu.com trusty/multiverse i386 Packages [134 kB]   
Get:23 http://us.archive.ubuntu.com trusty/main Translation-en [762 kB]        
Get:24 http://us.archive.ubuntu.com trusty/multiverse Translation-en [102 kB]  
Get:25 http://us.archive.ubuntu.com trusty/restricted Translation-en [3 457 B] 
Get:26 http://us.archive.ubuntu.com trusty/universe Translation-en [4 089 kB]  
Ign http://us.archive.ubuntu.com trusty/main Translation-en_US                 
Ign http://us.archive.ubuntu.com trusty/multiverse Translation-en_US           
Ign http://us.archive.ubuntu.com trusty/restricted Translation-en_US           
Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US             
Fetched 21,6 MB in 1min 7s (318 kB/s)                                          
Reading package lists... Done
W: Duplicate sources.list entry http://us.archive.ubuntu.com/ubuntu/ precise-updates/main i386 Packages (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_main_binary-i386_Packages)
W: Duplicate sources.list entry http://us.archive.ubuntu.com/ubuntu/ precise-updates/restricted i386 Packages (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_restricted_binary-i386_Packages)
W: Duplicate sources.list entry http://us.archive.ubuntu.com/ubuntu/ precise-updates/main i386 Packages (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_main_binary-i386_Packages)
W: Duplicate sources.list entry http://us.archive.ubuntu.com/ubuntu/ precise-updates/restricted i386 Packages (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_restricted_binary-i386_Packages)
W: Duplicate sources.list entry http://us.archive.ubuntu.com/ubuntu/ precise-updates/main i386 Packages (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_main_binary-i386_Packages)
W: Duplicate sources.list entry http://us.archive.ubuntu.com/ubuntu/ precise-updates/restricted i386 Packages (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_restricted_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems

I have common python2.7 installed, but I also need python-dev.

Also I have tried this from the related question (does not work for me):

echo "deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted" | sudo tee -a /etc/apt/sources.list.d/precise-updates.list
sudo apt-get update
sudo apt-get install python2.7-dev

Here is the output of this commands:

apt-cache policy python2.7-dev
apt-cache policy python2.7
apt-cache show python2.7
  • Try sudo rm -rf /var/lib/apt/lists /var/cache/apt to clear out the package lists so they can be redownloaded from scratch, then sudo apt-get update; sudo apt-get install python2.7-dev. – Olathe Mar 24 '16 at 5:04
  • It does not help :( – Gooman Mar 24 '16 at 5:06
  • Does this answer work? – Olathe Mar 24 '16 at 5:08
  • No. I have inserted the decision of this answer in my question. It does not help me. – Gooman Mar 24 '16 at 5:10
  • You missed the part where it says "Can you edit your question to include the output of:" – Olathe Mar 24 '16 at 5:12
up vote 0 down vote accepted

I have found the desicion using packages.ubuntu.com site.

  1. Edit file /etc/apt/sources.list (double click in your file manager or use sudo nano /etc/apt/sources.list from terminal) . Add new record to the list of packages:

    deb http://cz.archive.ubuntu.com/ubuntu wily main

  2. Close this file (Ubuntu will automatically update your packages). If it's not, then execute sudo apt-get update.

  3. Execute sudo apt-get install python-dev. It should work. If it does not, then try another packages links from here.

This means that you're mentioning deb http://us.archive.ubuntu.com/ubuntu precise-updates main and deb http://us.archive.ubuntu.com/ubuntu precise-updates restricted twice somewhere.

  1. Make sure that there's no mention of precise-updates in /etc/apt/sources.list. If there is copy it, remove it, and attempt another sudo apt-update && sudo apt-upgrade -y.

  2. Move to /etc/apt/sources.list.d. Check each file for a mention of precise-updates and remove the entire line on the first file you find. From this point you should be able to run sudo apt-update && sudo apt-upgrade -y successfully. If you can't, there's another duplicate somewhere in this directory and you need to run Step 2 again.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.