5

This problem has been torturing me for 2 days, and without python3-dev I can't pip install any module, can someone tell how could I solve this?

The following packages have unmet dependencies:
     python3-dev : Depends: python3 (= 3.5.1-3) but 3.5.1-4 is to be installed
                   Depends: libpython3-dev (= 3.5.1-3) but it is not going to be installed
                   Depends: python3.5-dev (>= 3.5.1-2~) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
vvvvv
  • 25,404
  • 19
  • 49
  • 81
Lucas
  • 167
  • 1
  • 2
  • 9
  • Did you try `sudo apt-get install -f`? – Mr_Z Oct 19 '18 at 07:14
  • What does `apt policy python3 python3-dev` output? – Stephen Kitt Oct 19 '18 at 10:56
  • 1
    This is problem with the `apt` ubuntu/debian package manager being in an inconsistent state. The question belongs on the askubuntu stackexchange site. [How do I resolve `The following packages have unmet dependencies`](https://stackoverflow.com/questions/26571326/how-do-i-resolve-the-following-packages-have-unmet-dependencies/35679746#35679746) – Håken Lid Oct 19 '18 at 11:26
  • 1
    First of all run `apt update` after try `apt remove python3` and now try to install `python3-dev`. – Gordio Oct 20 '18 at 01:35

3 Answers3

4

You can try to install package libpython3-dev instead of installing package python3-dev.

I have answered a similar question here: https://superuser.com/a/1407453/1000196

David17
  • 173
  • 1
  • 1
  • 9
2

I found a solution like this for myself on Ubuntu Desktop 20.04:

Go to "Software & Updates" application -> Then change your "Download from" server to "Main server". After this close and go terminal. Then sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove && sudo apt install python3-dev -y

Dharman
  • 30,962
  • 25
  • 85
  • 135
Hiko Moff
  • 21
  • 2
0

I met this issue, and I fixed it with steps below:

  1. I tried to install libpython3-dev or python3.7-dev, it told me that "Depends: libexpat1-dev but it is not going to be installed"
  2. So I tried to install libexpat1-dev, it told me that "Depends: libexpat1 (= 2.2.6-2+deb10u4) but 2.2.6-2+deb10u1 is to be installed"
  3. Then I update libexpat1 version to 2.2.6-2+deb10u4 with command "sudo apt-get install libexpat1=2.2.6-2+deb10u4"
  4. Next, I installed libexpat1-dev, python3.7-dev, python3-dev with command below:
sudo apt-get install libexpat1-dev
sudo apt-get install python3.7-dev
sudo apt-get install python3-dev
eraul
  • 63
  • 2