Unclean system-setup due to missing requirements of python packages

Asked by Max Henrik Balsmeier

Hi everyone.

So maybe this is a bug but I feel this does not meet the requirements for opening a bug, which is why I post it here.

I have to setup Ubuntu 20.04 VMs regularly, and I always use the following commands to update the python packages:

sudo apt-get update
sudo apt-get install python3-pip

python3:

import pkg_resources;
from subprocess import call;
packages = [dist.project_name for dist in pkg_resources.working_set];
call("pip3 install --upgrade " + " ".join(packages[1:-1]), shell = True);

This upgrades all installed python packages. However, installing PyGObject fails because some Debian packages are not installed. If I install them with

sudo apt install libcairo-dev libgirepository1.0-dev

prior to the python update, the error does no occur. It is unlogical that pre-existing python packages come without the underlying dependencies, and should not happen in fact. So either the set of pre-installed python packages on Ubuntu should be modified, so that PyGObject is not needed anymore, or the mentioned Debian packages should be installed beforehand (pre-installed).

I do not need advice, since I got this solved by installing the mentioned packages. But maybe this is worth improving in the next Ubuntu release.

Max

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Max Henrik Balsmeier
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

You are blaming the wrong one.

The Debian packages in Ubuntu are consistent.
The error is caused by pip / the pypi repository.
If pip errors out with dependency problems when doing a "pip install --upgrade", then this is a pip or pypi problem.

Revision history for this message
Max Henrik Balsmeier (mhbalsmeier) said :
#2

But pip cannot install Debian packages, can it? It can only install python dependencies, but some python packages require Debian packages and those cannot be installed by pip.

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

pip installs from the pypi repository, completely outside Ubuntu and Debian and that should not require any additional *.deb package (it should work the same way on Windows, and there are no *.deb packages). If a package from pypi needs additional software, then that should be provided by pypi.

What you do in fact is:
You Install an Ubuntu system and then overwrite all python packages that were installed by Ubuntu with the version from pypi.
In my opinion this does not make any sense. Why do you install Ubuntu, if you then do not want its packages?

"installing PyGObject fails because some Debian packages are not installed."
Which command fails and with which error message?

Revision history for this message
Max Henrik Balsmeier (mhbalsmeier) said :
#4

This will not lead to a solution here, since you guys seem to know what you pre-install and why.
Thanks anyway.