Reputation: 463
On Debian based Linux distributions pip
usually detects Python packages installed by apt
(in /usr/lib/pythonX/dist-packages
). However, this is not valid for PyQt5
for example (PyQt5
does not show up when running pip list
or pip freeze
). Does anyone know why?
With Docker you can run the following steps to reproduce the problem:
Run a Debian unstable:
docker run -it debian:unstable
Install python3-pip
and python3-pyqt5
:
apt update
apt install --no-install-recommends python3-pip python3-pyqt5
Run
pip3 list
Only pip
will be listed.
Install python3-requests
apt install --no-install-recommends python3-requests
and run
pip3 list
again. The requests
package will be listed.
Upvotes: 2
Views: 7961
Reputation: 6705
First, look what files are installed by the package:
dpkg-query -L python3-requests
In the output you will see:
/usr/lib/python3/dist-packages/requests-2.18.4.egg-info/PKG-INFO
This file starts with:
Metadata-Version: 1.1
Name: requests
Version: 2.18.4
The python3-pyqt5
package does not contain such file.
I can imagine, that some of the Debian packages do and others don't include this metadata.
The Debian FAQ states: (https://wiki.debian.org/Python/FAQ)
We don't want to provide ".egg" files within the .deb. However we want to make the "egg meta-information" available so that users can use eggs if they so wish. Python >= 2.5 does that by default in distutils. For setuptools based setup.py you need to pass the option "--single-version-externally-managed" to the "setup.py install" call.
Upvotes: 2
Reputation: 2908
It is indeed true that PyQt5 doesn't show up in the pip list
output. Instead pycairo
and PyGObject
would show up.
If you execute python3
and then run import PyQt5
it imports without any errors. I have checked it on a docker container with a base image of Ubuntu, however it should work the same for Debian.
root@d6b7f119b352:/# python3
Python 3.6.7rc1 (default, Sep 27 2018, 09:51:25)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>>
Or
>>> from PyQt5.QtWidgets import QApplication, QWidget, QLabel
>>>
Upvotes: 0