Reputation: 2038
Hi everyone and thanks for reading. I'm packaging my python code in a single file using pyinstaller, but when I run my packaged file I get the following error:
Traceback (most recent call last):
File "<string>", line 21, in <module>
File "C:\Users\****\Desktop\pyinstaller-2.0\pyinstaller-2.0\PyInstaller\loader\iu.py", line 409, in importHook
ImportError: No module named PyQt4.QtCore
I don't know what this error is telling me, especially since there is no dir name pyinstaller-2.0 on my desktop and I did not use PyQt4 at all.
Imported modules: Tkinter, tkFileDialog, tkMessageBox, multiprocessing, os, sys, time, numpy, scipy.weave, pywt, matplotlib.pyplot
I think the problem is related to multiprocessing
, since I did not experience this error before. I used this recipe to implement the multiprocessing
module correctly.
Upvotes: 3
Views: 3672
Reputation: 20373
If you were using PyQt
then the only way to import the modules with PyInstaller is to use
from PyQt4 import QtCore, QtGui
rather than
import PyQt4.QtCore, PyQt4.QtGui
which your error implies. However, you say that you're not using PyQt
.
PyQt
is an optional dependency of matplotlib
so there is a chance that PyInstaller is checking the matplotlib
module and consequently including PyQt
.
I would suggest excluding the PyQt
module from the build; in your .spec
file, search out the line for the Analysis
class - something like
Analysis( ..., excludes=['PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui'])
and edit the excludes
keyword arg as suggested above.
Upvotes: 3