Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 108322  / 1 Year ago, tue, february 28, 2023, 5:32:57

I am having trouble installing python-dev. It all started when I tried to install another Python package and got the error:





SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev.


I tried sudo apt-get install python-dev but got the error:



The following packages have unmet dependencies:
python-dev : Depends: python2.7-dev (>= 2.7.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


So then I tried sudo apt-get install python2.7-dev and got the error:



The following packages have unmet dependencies:
python2.7-dev : Depends: python2.7 (= 2.7.3-0ubuntu3) but 2.7.3-0ubuntu3.1 is to be installed
Depends: libpython2.7 (= 2.7.3-0ubuntu3) but 2.7.3-0ubuntu3.1 is to be installed


I have tried most everything in the post unmet dependencies. I am running Ubuntu 12.04 and I have everything updated. I have done apt-get clean and apt-get autoclean. I have tried apt-get -f install and all variations on that theme. I have cleaned up my PPA. I even tried using Aptitude, and though it did a lot of clean up, the result was the same.



I really want to be able to install python-dev. How can I make this happen? At this point, I am willing to consider extreme options, whatever they may be.


More From » apt

 Answers
1

This bit:





 python2.7-dev : Depends: python2.7 (= 2.7.3-0ubuntu3) but 2.7.3-0ubuntu3.1 is to be installed


suggests that you are using some mismatched repositories, or have some apt-pins in place keeping the version dependencies from lining up. I think, specifically, python-2.7 2.7.3-0ubuntu3.1 is in the Precise-proposed repository and the 2.7.3-0ubuntu3 version is in Precise/main proper, so you may be preferring -proposed for some but not all packages.



Can you edit your question to include the output of:



apt-cache policy python2.7-dev
apt-cache policy python2.7


and maybe:



apt-cache show python2.7


...



Reading the apt-cache output from your pastebin, it looks like you have the python2.7 2.7.3-0ubuntu3.1 from precise-updates/main installed, but python2.7-dev is from precise/main. I think your install media or an earlier "apt-get update" included the precise-updates repository, but it's not in your current sources.list.



I think you'll be able to get the install going after adding precise-updates and then apt-get update.



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

[#31976] Thursday, March 2, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
scusaper

Total Points: 335
Total Questions: 111
Total Answers: 119

Location: Belize
Member since Mon, Jun 20, 2022
2 Years ago
;