takluyver / pynsist

Build Windows installers for Python applications
https://pynsist.readthedocs.io/
Other
930 stars 123 forks source link

ModuleNotFoundError: No module named 'PyQt5.sip' #254

Closed jkfindeisen closed 2 years ago

jkfindeisen commented 2 years ago

I use pynsist 2.8 installed from PyPi

I have an installer.cfg with

[Python]
version=3.7.9
[Include]
pypi_wheels =  PyQt5==5.15.6

When I start the application after installation with the installer created by pynsist I get the following in the logging output

Traceback (most recent call last):
  File "XX.launch.pyw", line 34, in <module>
    from XX import main
  File "XX.py", line 9, in <module>
    from PyQt5 import QtWidgets, QtCore, QtGui
ModuleNotFoundError: No module named 'PyQt5.sip'

PyQt5 does not seem to get bundled correctly. (i.e. pip install pyqt5 installs sip as dependency automatically)

However adding

PyQt5-sip=12.9.0

to pypi_wheels solves the problem. So this is only for reference just in case somebody else has the same problem.

jkfindeisen commented 2 years ago

Oh sorry. I just realized this is by design because all dependencies have to be given. This could result in a lot of trial and error for packages with many dependencies (like for pandas for example). I guess I better use pip on a clean environment first and simply use all packages from that for pynsist.

takluyver commented 2 years ago

Yup, that's how it's meant to work. You can also use pip-tools to expand a list of dependencies into a full list of packages (like pip freeze, but without having to actually create the environment). I also experimented with identifying packages needed by running an application - see kartoffel, but it is very much a rough prototype.

One of the lessons from recent versions of pip is that proper dependency resolution is complicated and confusing, so I'm not in a hurry to try that in Pynsist.