Q:

PyQt5 dependency in a module on Debian

I have a Python module with a __main__ that uses PyQt5. I've installed PyQt5 on a Debian Buster box:
apt-get install python3-pyqt5

The __main__ program runs as expected if I execute
python3 mymodule/__main__.py

from the  source directory. Now I've installed the module into python:
python3 setup.py install

That worked. The setup.py lists a dependency on pyqt5:
setup(
    # ...
    install_requires=['PyQt5'],
    entry_points={"gui_scripts": ["mymodule = mymodule.__main__:main"]},

Setup created a script /usr/local/bin/mymodule. When I run that, I get an error message:

pkg_resources.DistributionNotFound: The 'PyQt5' distribution was not found and is required by mymodule

What am I missing?
EDIT: tried installing pyqt5 via pip, got the following error:
seva@sandbox:~$ sudo pip3 install pyqt5
Collecting pyqt5
Using cached  https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz
Installing build dependencies ... done
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.7/tokenize.py", line 447, in open
    buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-26kj5hrc/pyqt5/setup.py'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-26kj5hrc/pyqt5/

A:

OS-level package managers are designed to be consistent within itself. But they aren't designed to interoperate with language package managers. apt-get-installed python3-pyqt5 could be recognized by other Debian packages but not by pip/setuptools.
So either you convert your package to .deb (using stdeb, for example), set dependency to python3-pyqt5 and install it with apt/apt-get/dpkg. Or you install everything using pip:
pip install pyqt5
pip install .  # to install your package

If your dependencies are properly declared in the package the latter command should be enough — pip will run the former itself.
PS. Also please consider virtualenv to separate pip-installed packages from system-installed. virtualenv itself could be system-installed or user-installed:
apt install python3-virtualenv

or
pip install [--user] virtualenv

