ImportError: No module named 'PyQt5.sip'

Patrick Stinson patrickkidd at gmail.com
Wed Apr 29 00:54:20 BST 2020


Thanks for the explanation.

So an extension like PyQt5, during it’s own configure phase, should generate it’s own private sip module using the installed sip-module tool from sip 5? Then that private sip module is built during PyQt5’s build phase, and installed in the PyQt5 package dir during the PyQt5 install phase?

> On Apr 28, 2020, at 1:08 PM, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 
> With SIP v4 the code generator and the sip module were tied together. Before private sip modules were introduced "building SIP" meant building them both. This approach causes many problems...
> 
> - otherwise unrelated packages have a dependency on a common sip module and may have conflicting version requirements. Private sip modules (pioneered by Robin Dunn for wxPython) avoid this problem.
> 
> - the code generator and the sip module have the same version number. It can make it impossible to upgrade the code generator (for bug fixes) without having to upgrade the sip module. It also makes semantic versioning impossible.
> 
> The SIP v5 code generator (ie. SIP) has its own (semantic) version number.  The sip module has its own, completely independent, (semantic) version number. The sip module is created using SIP v5's sip-module tool. sip-module will build *any* supported version of the sip module (see the --abi-version option). This means you can update SIP v5 to a later version but still use an older version of the sip module.
> 
> Phil
> 
> On 28/04/2020 21:41, Patrick Stinson wrote:
>> I have gone through them. The closest thing I found that applies might be:
>> https://www.riverbankcomputing.com/static/Docs/sip/introduction.html#support-for-old-versions-of-python
>> <https://www.riverbankcomputing.com/static/Docs/sip/introduction.html#support-for-old-versions-of-python>
>> But I’m not sure. It may just be me, but I find it hard to follow and
>> decided it didn’t have anything to do with my question.
>> Or am I off base? I am fairly familiar with sip 4, but having trouble
>> understanding the roadmap to move to sip-5. Maybe I have to have a
>> better understanding of wheels?
>>> On Apr 28, 2020, at 12:33 PM, Phil Thompson <phil at riverbankcomputing.com> wrote:
>>> On 28/04/2020 19:03, Patrick Stinson wrote:
>>>> Also, I just tried:
>>>> 	pip install .
>>>> For sip-5.2.0 with Python-3.7.7 and it didn’t install the sip module
>>>> in site-packages or site-packages/PyQt5.
>>>> Not sure what to do there….
>>> Read the docs? Installing SIP v5 has nothing to do with installing the sip module.
>>> Phil
>>>>> On Apr 28, 2020, at 5:51 AM, Patrick Stinson <patrickkidd at gmail.com> wrote:
>>>>> I suppose this is more of a pip question at this point, but do you know how to get:
>>>>> pip install .
>>>>> or
>>>>> pip install PyQt5_sip-12.7.2.tar.gz
>>>>> to build with debugging symbols? At first glance I don’t see anything like that in the pip docs.
>>>>>> On Apr 28, 2020, at 5:48 AM, Patrick Stinson <patrickkidd at gmail.com> wrote:
>>>>>> Oh wow, it looks like I am also out of touch with pip and its capabilities.
>>>>>> “pip install .” Worked for me using sip-5.2.0.tar.gz.
>>>>>> Sounds like your idea to detect setup.py is a good one, however.
>>>>>>> On Apr 28, 2020, at 5:09 AM, Phil Thompson <phil at riverbankcomputing.com> wrote:
>>>>>>> Aah - I never build in that particular way, I always use pip to build the PyQt5.sip module.
>>>>>>> To build from an unpacked source package...
>>>>>>> pip install .
>>>>>>> To build from a local source package...
>>>>>>> pip install PyQt5_sip-12.7.2.tar.gz
>>>>>>> To build from source from PyPI...
>>>>>>> pip install --no-binary :all: PyQt5-sip
>>>>>>> I'll try and detect if 'python setup.py' is being used and either fix it or fail with an error message.
>>>>>>> Phil
>>>>>>> On 28/04/2020 13:39, Patrick Stinson wrote:
>>>>>>>> Phil,
>>>>>>>> It seems to me that this is likely documented somewhere since it is a
>>>>>>>> latest-version source build with generic options?
>>>>>>>> -Patrick
>>>>>>>>> On Apr 27, 2020, at 11:26 PM, Patrick Stinson <patrickkidd at gmail.com> wrote:
>>>>>>>>> Now I am asking the same question as the OP. I built Python-3.8.4, sip-5.2.0, and PyQt5-5.14.2 on macOS and got the same error.
>>>>>>>>> I built sip with “python setup.py install”
>>>>>>>>> turin:vendor patrick$ python -c "import PyQt5.QtGui"
>>>>>>>>> Traceback (most recent call last):
>>>>>>>>> File "<string>", line 1, in <module>
>>>>>>>>> ModuleNotFoundError: No module named 'PyQt5.sip'
>>>>>>>>> -Patrick
>>>>>>>>>> On Apr 27, 2020, at 1:33 PM, Phil Thompson <phil at riverbankcomputing.com> wrote:
>>>>>>>>>>> On 27/04/2020 22:19, Gabriele Bulfon wrote:
>>>>>>>>>>> Great Phil, that's where I pulled sources for both of them.
>>>>>>>>>>> I have built and packaged PyQt5-sip and PyQt5 from those sources,
>>>>>>>>>>> after building and packaging sip5 and PyQt-builder.
>>>>>>>>>>> Maybe there's something wrong in what I'm delivering to the system
>>>>>>>>>>> with PyQt5-sip?
>>>>>>>>>>> Here's a brief of the files delivered by my package, as in the package
>>>>>>>>>>> definition file (pkg, solaris).
>>>>>>>>>>> I derived this from the prototype area generated by the build/install
>>>>>>>>>>> on the prototype install root.
>>>>>>>>>>> I bet something is wrong with the sip.cpython-35m.so file...I still
>>>>>>>>>>> don't understand how these cpython so files are looked up, but that is
>>>>>>>>>>> what the build system created in the prototype area.
>>>>>>>>>>> dir path=usr
>>>>>>>>>>> dir path=usr/lib
>>>>>>>>>>> dir path=usr/lib/python$(PYVER)
>>>>>>>>>>> dir path=usr/lib/python$(PYVER)/vendor-packages
>>>>>>>>>>> dir path=usr/lib/python$(PYVER)/vendor-packages/PyQt5
>>>>>>>>>>> dir
>>>>>>>>>>> path=usr/lib/python$(PYVER)/vendor-packages/PyQt5_sip-12.7.2-py$(PYVER).egg-info
>>>>>>>>>>> file usr/lib/python$(PYVER)/vendor-packages/PyQt5/sip.cpython-35m.so
>>>>>>>>>>> path=usr/lib/python$(PYVER)/vendor-packages/PyQt5/sip.cpython-35m.so
>>>>>>>>>>> file
>>>>>>>>>>> path=usr/lib/python$(PYVER)/vendor-packages/PyQt5_sip-12.7.2-py$(PYVER).egg-info/PKG-INFO
>>>>>>>>>>> file
>>>>>>>>>>> path=usr/lib/python$(PYVER)/vendor-packages/PyQt5_sip-12.7.2-py$(PYVER).egg-info/SOURCES.txt
>>>>>>>>>>> file
>>>>>>>>>>> path=usr/lib/python$(PYVER)/vendor-packages/PyQt5_sip-12.7.2-py$(PYVER).egg-info/dependency_links.txt
>>>>>>>>>>> file
>>>>>>>>>>> path=usr/lib/python$(PYVER)/vendor-packages/PyQt5_sip-12.7.2-py$(PYVER).egg-info/top_level.txt
>>>>>>>>>> I would expect to see .dist-info rather than .egg-info. Maybe your setuptools is too old.
>>>>>>>>>> Phil
> 



More information about the PyQt mailing list