Pyinstaller performance issues

1,544 views
Skip to first unread message

Massi

unread,
Sep 6, 2013, 10:27:22 AM9/6/13
to pyins...@googlegroups.com
Hi everyone,

I'm using pyinstaller 2.0 to create a windows executable from my python code. It is big program which involves lots of  packages (pyQt, matplotlib, scipy, numpy, SqlAlchemy only to mention a few). The executable is generated correctly, but when the program runs there's a terrible slowdown of the performances (up to 5-6 times slower) with respect to the execution from code. I'm not talking about the application start time (as I read in other threads), nor the executable is build in one file mode. The problem affects all the execution of the program.
Can anyone point me out any possible reason? I'm not a pyinstaller expert so please forgive me if I'm not aware of some magic flags which speed up the execution :-)

Thanks in advance!

Martin Zibricky

unread,
Sep 6, 2013, 10:32:35 AM9/6/13
to pyins...@googlegroups.com

On Friday 06 of September 2013 07:27:22 Massi wrote:

Hi everyone, I'm using pyinstaller 2.0 to create a windows executable from my python  code. It is big program which involves lots of  packages (pyQt, matplotlib,  scipy, numpy, SqlAlchemy only to mention a few). The executable is  generated correctly, but when the program runs there's a terrible slowdown  of the performances (up to 5-6 times slower) with respect to the execution  from code. I'm not talking about the application start time (as I read in  other threads), nor the executable is build in one file mode. The problem  affects all the execution of the program. Can anyone point me out any possible reason? I'm not a pyinstaller expert  so please forgive me if I'm not aware of some magic flags which speed up  the execution Thanks in advance!

 

Could you please test the development version and compare the performance?

Massi

unread,
Sep 6, 2013, 10:40:49 AM9/6/13
to pyins...@googlegroups.com
With the development version the exe generation crashes with this error:

29789 INFO: Writing RT_GROUP_ICON 0 resource with 20 bytes
29789 INFO: Writing RT_ICON 1 resource with 41640 bytes
Traceback (most recent call last):
  File "..\pyinstaller\pyinstaller.py", line 18, in <module>
    run()
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\main.py", line
88, in run
    run_build(opts, spec_file, pyi_config)
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\main.py", line
46, in run_build
    PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\build.py", line
 1920, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\build.py", line
 1869, in build
    execfile(spec)
  File "C:\Users\Impara 01\Desktop\Trunk\RulexInterface\Rulex.spec", line 15, in
 <module>
    console=False , version='versioninfo.txt', icon='colorrulex.ico')
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\build.py", line
 1169, in __init__
    self.__postinit__()
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\build.py", line
 305, in __postinit__
    self.assemble()
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\build.py", line
 1236, in assemble
    versioninfo.SetVersion(tmpnm, self.versrsrc)
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\utils\versionin
fo.py", line 558, in SetVersion
    win32api.UpdateResource(hdst, RESOURCE_TYPE['RT_VERSION'], 1, vs.toRaw())
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\utils\versionin
fo.py", line 173, in toRaw
    tmp = "".join([kid.toRaw() for kid in self.kids ])
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\utils\versionin
fo.py", line 348, in toRaw
    tmp = ''.join([kid.toRaw() for kid in self.kids])
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\utils\versionin
fo.py", line 395, in toRaw
    raw = kid.toRaw()
  File "C:\Users\Impara 01\Desktop\Trunk\pyinstaller\PyInstaller\utils\versionin
fo.py", line 442, in toRaw
    vallen = len(raw_val) + 2
UnboundLocalError: local variable 'raw_val' referenced before assignment

Martin Zibricky

unread,
Sep 6, 2013, 10:53:28 AM9/6/13
to pyins...@googlegroups.com

Could you try it without the icon and version file?

 

version file info format was slightly changed.

Massi

unread,
Sep 6, 2013, 11:10:06 AM9/6/13
to pyins...@googlegroups.com
I tried without icon an version file, the executable is generated but nothing changed, still very slow.

Martin Zibricky

unread,
Sep 6, 2013, 3:40:04 PM9/6/13
to pyins...@googlegroups.com

On Friday 06 of September 2013 08:10:06 Massi wrote:

I tried without icon an version file, the executable is generated but  nothing changed, still very slow.



In that case I suggest trying some debugging:

 

- look at the file ./PyInstaller/loader/pyi_importers.py

- look at the manual http://pythonhosted.org/PyInstaller/

to see how to pass the python '-v' option to pyinstaller to be able to trace import statements.

 

http://pythonhosted.org/PyInstaller/#getting-python-s-verbose-imports

 

Reply all
Reply to author
Forward
0 new messages