libpq-dev python3-dev couldnot install in ubuntu 22.10? - python

sudo apt install libpq-dev python3-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-dev is already the newest version (3.10.6-1).
python3-dev set to manually installed.
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:
libpq-dev : Depends: libpq5 (= 14.5-1ubuntu1) but 15.1-1.pgdg22.10+1 is to be installed
E: Unable to correct problems, you have held broken packages.

You have to reinstall the libpq5 with the correct version required by libpq-dev.
sudo apt install libpq5=14.5-1ubuntu1
Then try to install the libpq-dev.

Related

Can't install python3-venv in Ubuntu 20.04, some broken packages

This might be long but please bear with me till the end
When I tried to install python3-venv while following this article
sudo apt install build-essential libssl-dev libffi-dev python3-dev
It threw the following error:
libffi-dev python3-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libffi-dev is already the newest version (3.3-4).
build-essential is already the newest version (12.8ubuntu1.1).
libssl-dev is already the newest version (1.1.1f-1ubuntu2.16).
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:
python3-dev : Depends: libpython3-dev (= 3.8.2-0ubuntu2) but it is not going to be installed
Depends: python3.8-dev (>= 3.8.2-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So instead of python3-dev, I tried python3 only and it ran.
After that, I ran this command:
sudo apt install -y python3-venv
Then it gave me this:
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:
python3-venv : Depends: python3.8-venv (>= 3.8.2-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So I thought maybe I need to install python3.8-venv, so I did:
sudo apt install -y python3.8-venv
AND, it gave me this error:
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:
python3.8-venv : Depends: python3.8 (= 3.8.10-0ubuntu1~20.04.5) but 3.8.13-1+bionic2 is to be installed
E: Unable to correct problems, you have held broken packages.
THEN, I tried:
sudo apt install -y python3.8
which was fine and gave me this
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3.8 is already the newest version (3.8.13-1+bionic2).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
I don't know what to do, my virtual env isn't working, I read somewhere that it's pre-installed so I also tried directly creating a virtual env with
python3 -m venv myEnv
Which again gave me this:
Error: Command '['/home/yash/Desktop/DashMed/myEnv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
which upon googling said to install python3-venv which I've already failed in
SO I AM STUCK IN THIS LOOP
PLEASE HELP
The main reason for these issues was the version of python3.8
I had version 3.8.13-1+bionic2 but we needed 3.8.10-0ubuntu1~20.04.5
I think this generally occurs when you upgrade from Ubuntu 18.04 LTS to Ubuntu 20.04 LTS using in-built Software & Updates
So I found this command which rolled back the versions now everything works fine
sudo apt install libpython3.8:amd64=3.8.2-1ubuntu1 libpython3.8-dev:amd64=3.8.2-1ubuntu1 libpython3.8-minimal:amd64=3.8.2-1ubuntu1 libpython3.8-stdlib:amd64=3.8.2-1ubuntu1 python3.8=3.8.2-1ubuntu1 python3.8-minimal=3.8.2-1ubuntu1
After this, all those other commands ran perfectly on my system
I found this rollback command here

This is the result I get when trying to install pip3

This is the result I get when trying to install pip3.
sudo apt-get install python3-pip
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:
gnome-session-common : Breaks: eog (< 3.36.0) but 3.26.1-1 is to be installed
kali-menu : Breaks: python-faraday (< 3.10.0)
python3-pip : Depends: python3-distutils but it is not going to be installed
Depends: python3-setuptools but it is not going to be installed
Recommends: build-essential but it is not going to be installed
Recommends: python3-dev (>= 3.2) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
This error can be caused by an incomplete package installation.
Try:
sudo apt-get update && sudo apt-get upgrade
Then run the install command again.
sudo apt-get install python3-pip

Package 'python-tk' has no installation candidate

I am trying it install Tinker on my Ubuntu 17.04 but some how it does not seem working, I have used all these command on the terminal
sudo apt-get install update
sudo apt-get install upgrade
sudo apt-get install python-tk
sudo apt-get install python3-tk
Every time I am getting :
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-tk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-tk' has no installation candidate

Installing pygame on ubuntu

I am trying to install pygame on an Ubuntu 16.04 system. My default python is 2.7.12. I opened terminal and tried:
sudo apt-get install python-pygame
I got this message:
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-pygame : Depends: python-numpy (>= 1:1.8.0) but it is not going to be installed
Depends: python-numpy-abi9
E: Unable to correct problems, you have held broken packages.
I then tried to install numpy and got the same message except:
The following packages have unmet dependencies:
python-numpy : Depends: python:any (>= 2.7.5-5~)
What should I do?
Figured it out. Found a terminal command to reinstall python:
sudo apt-get purge python && sudo apt-get install python2.7
sudo apt-get install -f
it fixes the broken dependencies

Error Getting Dependencies for Matplotlib

I am trying to install the python package matplotlib from source. I cannot install the package from the repository using sudo apt-get install python-matplotlib because I need to be able to install the package in a virtualenv using a requirmenets.txt file. When I follow the instructions to install dependencies I get the following error:
vagrant#vagrant-ubuntu-trusty-64:~$ sudo apt-get build-dep python-matplotlib
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'matplotlib' as source package instead of 'python-matplotlib'
The following packages have unmet dependencies:
python3-all-dbg : Depends: libpython3-all-dbg (= 3.4.0-0ubuntu2) but it is not going to be installed
Depends: python3-dbg (= 3.4.0-0ubuntu2) but it is not going to be installed
Depends: python3.4-dbg but it is not going to be installed
python3-all-dev : Depends: libpython3-all-dev (= 3.4.0-0ubuntu2) but it is not going to be installed
Depends: python3-dev (= 3.4.0-0ubuntu2) but it is not going to be installed
Depends: python3.4-dev but it is not going to be installed
python3-numpy-dbg : Depends: python3-dbg but it is not going to be installed
E: Build-dependencies for python-matplotlib could not be satisfied.
How do I fix the problem? I have already run sudo apt-get update and
sudo apt-get upgrade to no avail. Could I just directly install the dependencies listed in the error message (I thought that was the point of the command)? I am not even using Python 3 so not concerned about having the packages installed (though not sure why I need them either). When I try running pip install -r requirements.txt in the virtual environment I still get an error on installing matplotlib.
Generally you get this message when you're missing some repository - you could check the list of your active repo from /etc/apt/sources.list. In your case you might miss the -srcrepo
What is strange is that python3-dev is from main repo so it should be activated by default.
You can add repo by editing the file /etc/apt/sources.list
sudo vi /etc/apt/sources.list
and add the following lines
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://br.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
You can get more info about the available repo from this link
make sure to (re)run sudo apt-get update after you've done this change and you should be ok to install your dependencies

Categories