PySide and PyQt collide when packing pylab under Windows 7

I tried to pack a little script that does some builds with pylab. I used pyinstaller on Linux without problems, but on Windows 7 I get an error. On another computer on which PySide but not PyQt is installed, the packaging worked. Thus, by removing PyQt, I can make it work on my other computer. However, I would like to know if there is another way to solve this problem, as I have some scripts that use PyQt and some that use PySide. I got a similar error using cx_freeze.

Thanks for your help, Daniel

Sample code that shows the problem:

from pylab import * labels = 'Cakes', 'Cookies', 'Biscuits', 'Tarts' fracs = [27, 33, 14, 19] pie(fracs, labels=labels, autopct='%1.1f%%', startangle=90) show() 

An error occurred while executing a packaged program:

 WARNING: file already exists but should not: C:\Users\..\Temp\_MEI61562\Include\pyconfig.h Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module exec(bytecode, module.__dict__) File "C:\Workspace\ZLC_python\build\test\out00-PYZ.pyz\pylab", line 1, in <module> File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module exec(bytecode, module.__dict__) File "C:\Workspace\ZLC_python\build\test\out00-PYZ.pyz\matplotlib.pylab", line 269, in <module> File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module exec(bytecode, module.__dict__) File "C:\Workspace\ZLC_python\build\test\out00-PYZ.pyz\matplotlib.pyplot", line 93, in <module> File "C:\Workspace\ZLC_python\build\test\out00-PYZ.pyz\matplotlib.pyplot", line 80, in _backend_selection File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 409, in load_module module = imp.load_module(fullname, fp, filename, self._c_ext_tuple) ImportError: DLL load failed: The specified procedure could not be found. 

Following the Pyinstaller recommendations - a single-file warning pyconfig.h when importing scipy or scipy.signal I got rid of the warning, but the error remains.

Versions:

  • Python 2.7.5
  • PySide 1.2.1
  • PyQt 4.9.6-3
  • matplotlib 1.2.1
  • numpy 1.7.1
  • pyinstaller 2.1
0
source share
1 answer

I looked at the pyinstaller documentation in detail and found a solution for pyinstaller. I used the exception parameter in the "Analysis" block of the specification file:

 # -*- mode: python -*- a = Analysis(['test.py'], pathex=['C:\\Workspace\\ZLC_python'], hiddenimports=[], hookspath=None, excludes=['PyQt4'], runtime_hooks=None) for d in a.datas: if 'pyconfig' in d[0]: a.datas.remove(d) break pyz = PYZ(a.pure) exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name='test.exe', debug=False, strip=None, upx=True, console=True ) 
+2
source

Source: https://habr.com/ru/post/969423/


All Articles