[PyQt] PyQt5-sip 4.19.13 required for PyQt5 5.11.3 but not in python package

Kyle Altendorf sda at fstab.net
Sun Nov 4 02:53:37 GMT 2018

On 2018-11-03 17:39, Damon Lynch wrote:

> Unless I'm mistaken, for now the latest PyQt5 requires the latest 
> PyQt5_sip, but the packaging of PyQt5 does not specify this 
> requirement.
> For example, on Fedora 29:
> [damon at localhost ~]$ pip3 install --user PyQt5
> Requirement already satisfied: PyQt5 in 
> ./.local/lib/python3.7/site-packages (5.11.3)
> Requirement already satisfied: PyQt5_sip<4.20,>=4.19.11 in 
> /usr/lib64/python3.7/site-packages (from PyQt5) (4.19.12)

So this did nothing because it found a pre-existing --user install.  It 
didn't install the PyPI PyQt5_sip package because it found a 
'satisfactory' system installed copy.  I just did an install in a venv 
to check and the sip is installed literally into the site-packages\PyQt5 
directory (sorry, I'm oddly in Windows right now so... \ not /).

> [damon at localhost ~]$ python3
> Python 3.7.1 (default, Oct 23 2018, 18:19:07)
> [GCC 8.2.1 20180801 (Red Hat 8.2.1-2)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from PyQt5 import QtCore
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ModuleNotFoundError: No module named 'PyQt5.sip'

I can't say I'm intimately familiar with namespace packages or what else 
PyQt5 might be doing but given that the PyPI PyQt5_sip package installs 
sip.pyd directly into the site-packages\PyQt5 directory I'm not 
particularly surprised that it doesn't find the system-package copy of 

> [damon at localhost ~]$ pip3 install -U --user PyQt5_sip
> Collecting PyQt5_sip
> Using cached 
> https://files.pythonhosted.org/packages/2b/9b/37e4f07ddac00e7eff4dd216c330a66cb1221e9c510855055391b779ee77/PyQt5_sip-4.19.13-cp37-cp37m-manylinux1_x86_64.whl
> Installing collected packages: PyQt5-sip
> Successfully installed PyQt5-sip-4.19.13

You have now encouraged pip sufficiently to install PyQt5_sip from PyPI 
and into the same place as the PyQt5 you are testing with.

> [damon at localhost ~]$ python3
> Python 3.7.1 (default, Oct 23 2018, 18:19:07)
> [GCC 8.2.1 20180801 (Red Hat 8.2.1-2)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from PyQt5 import QtCore

And now it works.

The system pip is not usually a great thing to use.  It's bad enough at 
dependency resolution on it's own without getting into these mixed 
scenarios.  On many Linux systems if you run it as root (such as with 
sudo) you can end up making pip itself not run, have other package 
issues, or even cause your system to be unable to boot.  Just depends 
what you install into what Python and what Python stuff your OS uses.  
--user won't break your os but it can break pip such as if you update 
pip but still run /usr/bin/pip (or similar) instead of ~/.local/bin/pip. 
  If you --user particular things (say package X) then use system 
packages that depend on X you may end up with a broken setup because the 
system package isn't compatible with the version of X you used.  Or, you 
could have what happened here where you don't get a dependency installed 
because it's already provided by the system.

Sure, you can run pip with sudo and you can --user and things might not 
break...  but I find it easier just to work in a virtualenv or venv and 
not have to think about all those hazards and nuances.  bit.ly/py-env

For completeness, the PyQt5 5.11.3 Linux 64-bit .whl specifies the 
following dependency which agrees with what pip mentioned in your 

Requires-Dist: PyQt5_sip (>=4.19.11, <4.20)

I also tried installing PyQt5_sip 4.19.11 and 4.19.13 (the earliest and 
latest that match that requirement, or exist for that matter) and was 
able to "import PyQt5.QtCore" in all cases without error.  I don't know 
how useful a test that is but it was a quick thing to make sure it 
wasn't totally broken.  So, per that minimal 'test' it seems the 
dependency version specs are fine.


More information about the PyQt mailing list