To install Docker I need to run:
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
which requires software-properties-common.
When I try to install software-properties-common with sudo apt-get install, the following error occurs:
The following packages have unmet dependencies:
software-properties-common : Depends: python3-software-properties (= 0.96.20.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So then I try to install python3-software-properties and this shows:
The following packages have unmet dependencies:
python3-software-properties : Depends: python3-pycurl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
And if I try to install python3-pycurl:
The following packages have unmet dependencies:
python3-pycurl : Depends: python3 (< 3.6) but 3.6.7-1~18.04 is to be installed
E: Unable to correct problems, you have held broken packages.
So does this mean my Python version has to be <3.6 ? This seems to be really weird. Thanks in advance for any help.
Turns out the sources in my sources.list were broken. Previously I was using Aliyun's sources (since I'm located in China) which caused the errors above. Switching to Tsinghua's sources fixed the issue.
Related
installing pyqt5 on ubuntu gives the following error messages:
sudo apt-get install python3-pyqt5
...
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libpython3.10 : Depends: libpython3.10-stdlib (= 3.10.4-1+focal2) but 3.10.3-1+focal1 is to be installed
libpython3.10-dev : Depends: libpython3.10-stdlib (= 3.10.4-1+focal2) but 3.10.3-1+focal1 is to be installed
python3-pyqt5 : Depends: libqt5core5a (>= 5.12.4) but it is not going to be installed
Depends: ....
python3.10 : Depends: libpython3.10-stdlib (= 3.10.4-1+focal2) but 3.10.3-1+focal1 is to be installed
python3.10-minimal : Depends: libpython3.10-minimal (= 3.10.4-1+focal2) but 3.10.3-1+focal1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I tried to solve the issue with the following code that shows the results.
sudo apt --fix-broken install
...
The following additional packages will be installed:
libpython3.10-minimal libpython3.10-stdlib
The following packages will be upgraded:
libpython3.10-minimal libpython3.10-stdlib
2 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
8 not fully installed or removed.
Do you want to continue? [Y/n] y
(Reading database ... 109785 files and directories currently installed.)
Preparing to unpack .../libpython3.10-stdlib_3.10.4-1+focal2_amd64.deb ...
Unpacking libpython3.10-stdlib:amd64 (3.10.4-1+focal2) over (3.10.3-1+focal1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-stdlib_3.10.4-1+focal2_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.10/_sysconfigdata__linux_x86_64-linux-gnu.py', which is also in package libpython3.10-minimal:amd64 3.10.3-1+focal1
Preparing to unpack .../libpython3.10-minimal_3.10.4-1+focal2_amd64.deb ...
Unpacking libpython3.10-minimal:amd64 (3.10.4-1+focal2) over (3.10.3-1+focal1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+focal2_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.10/typing.py', which is also in package libpython3.10-stdlib:amd64 3.10.3-1+focal1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libpython3.10-stdlib_3.10.4-1+focal2_amd64.deb
/var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+focal2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run the below commands to clear any issues then try again.
apt-get check
apt-get --fix-broken install
dpkg --configure -a
apt-get autoremove -y
apt-get autoclean
apt-get clean
Then remove the broken python files
sudo dpkg --remove --force-all libpython3.10-minimal libpython3.10-stdlib
sudo apt install libpython3.10-minimal libpython3.10-stdlib
sudo apt-get install python3-pyqt5
This is what i got after sudo apt-get install --reinstall python
$ sudo apt-get install --reinstall python
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
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
Depends: libpython-stdlib (= 2.7.15~rc1-1) but it is not going to be installed
python3-gi-cairo : Depends: python3-gi (= 3.26.1-2ubuntu1) but 3.26.1-2 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
sudo apt-get install letsencrypt
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:
` letsencrypt : Depends: python-letsencrypt (= 0.4.1-1) but it is not going to be installed
Depends: python:any (>= 2.7~)
E: Unable to correct problems, you have held broken packages.`
Remove the python package from ubuntu
and install python-dev
sudo apt-get remove python
sudo apt-get install python-dev
This should solve the letsencrypt installation
As be mentioned above, I tried to install python-pip and python-dev with command:
sudo apt-get install python-pip python-dev
then I get:
sudo apt-get install python-pip python-dev
[sudo] password for tailongnguyen:
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: python (= 2.7.11-1) but 2.7.12-1 is to be installed
python-pip : Depends: python:any (< 2.8)
Depends: python:any (>= 2.7.5-5~)
Recommends: python-all-dev (>= 2.6) but it is not going to be installed
Recommends: python-setuptools but it is not going to be installed
Recommends: python-wheel but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
What I need to do now?
I tried
sudo apt-get update
sudo apt-get upgrade
but it didn't help
See this link. This resolved this issue, though I got similar issue with apache2.2-common after fixing this.
https://askubuntu.com/questions/275861/problem-installing-python-dev
I am trying to install psycopg2 on the server for a Django application inside a virtualenv. I have managed to install it in the past successfully by running this command sudo apt-get -y install libpq-dev python-dev python2.7-dev before pip install psycopg2.
But now when I try to execute the first command, it shows the following error.
The following packages have unmet dependencies:
libpq-dev : Depends: libssl-dev but it is not going to be installed
Depends: libkrb5-dev but it is not going to be installed
Depends: comerr-dev but it is not going to be installed
python2.7-dev : Depends: libexpat1-dev but it is not going to be installed
Depends: libssl-dev but it is not going to be installed
Recommends: libc6-dev but it is not going to be installed or
libc-dev
E: Unable to correct problems, you have held broken packages.
How do I solve this?