Score:0

dpkg-query: package 'python' is not installed and no information is available

eg flag
Docker image OS version - Ubuntu 20.04.3 LTS.
Python 2.7.18

During our project source code build time getting below errors.

dpkg-query: package \'python\' is not installed and no information is available'
Use dpkg --info (= dpkg-deb --info) to examine archive files.'

Python 2.7.18 already installed, But not sure why dpkg returning not installed.

$ docker exec -it e5f58a8cef4f apt-get update
Fetched 8489 kB in 7s (1293 kB/s)
Reading package lists... Done

$ docker exec -it r5f58a8aef4f apt -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 75 not upgraded.

$ docker exec -it r5f58a8aef4f apt 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: python (= 2.7.11-1)
E: Unable to correct problems, you have held broken packages.
$ docker exec -it r5f58a8aef4f apt policy python
python:
  Installed: (none)
  Candidate: 2.7.11-1
  Version table:
     2.7.11-1 500
        500 http://dk.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Please suggest a solution.

Someone avatar
my flag
Try `sudo apt update; sudo apt -f install; sudo apt install python-dev`
user4948798 avatar
eg flag
`apt update` and `apt -f install` successfully finished, but `apt install python-dev` fails, Results added in the question.
Someone avatar
my flag
Please add the output of `apt policy python`
Someone avatar
my flag
Are you using a custom version of Python? Did you compile it yourself? Any specific reason for it?
user4948798 avatar
eg flag
It is not custom one in dockerfile i have `RUN apt-get update && \ apt-get -y install --fix-missing libsdl1.2-dev libasound2-dev libxcomposite-dev libv4l-dev python`
Someone avatar
my flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/134196/discussion-between-someone-and-user4948798).
user535733 avatar
cn flag
Your output suggests that you are trying to install Xenial (16.04) packages of Python2 onto a Focal (20.04) system, Why can't you use the Focal packages of Py2?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.