Packaging on 64 bit windows w/ cx_oracle, onefile, and pyinstaller

398 views
Skip to first unread message

Bryan Lott

unread,
Apr 24, 2014, 4:19:25 PM4/24/14
to kivy-...@googlegroups.com
Here's my setup:
Windows 7 x64
Python 2.7.6 64 bit
cx_oracle 5.1.2 - 11g 64 bit
pyinstaller 2.1
A relatively simple GUI python application that uses a .kv file and cx_Oracle.

I am unable to build a working executable using pyinstaller and any of the above.

If I try to use pyinstaller without running kivy.bat the resulting executable is unable to import styles.kv.
If I use the kivy.bat to try to run pyinstaller, I end up with an executable that gives me an unable to import cx_oracle error.
If I then put cx_Oracle.pyd either in my kivy\python27\lib\site-packages folder OR in my python script's folder, the resulting executable gives ImportError: DLL load failed: %1 is not a valid Win32 application.  I have also tried this with the 32 bit cx_Oracle.pyd file with the same results.

Some guidance would be incredibly helpful at this point as I'm unable to give my users python + kivy + my script.  It must be packaged as a single executable file.

Please let me know if you need any further information or if I've left something out.
Thanks!
Bryan

Ben Rousch

unread,
Apr 24, 2014, 4:25:28 PM4/24/14
to kivy-...@googlegroups.com
Step 3 here should eliminate the styles.kv problem: http://kivy.org/docs/guide/packaging-windows.html#create-the-spec-file

As for cx_oracle ... you may have better luck in one of their support forums.


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
 Ben Rousch
   bro...@gmail.com
   http://clusterbleep.net/

Bryan Lott

unread,
Apr 24, 2014, 4:29:00 PM4/24/14
to kivy-...@googlegroups.com
This is my spec file, I followed step 3 and that removed the issue with styles.kv but only if I run pyinstaller from within the kivy.bat environment.

# -*- mode: python -*-
from kivy.tools.packaging.pyinstaller_hooks import install_hooks
install_hooks(globals())
a = Analysis(['c:\\code\\schema autoprefix\\SchemaAutoprefix.py'],
             pathex=['C:\\code\\Schema Autoprefix'],
             hiddenimports=[],
             runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='AutoPrefix-x64.exe',
          debug=False,
          strip=None,
          upx=True,
          console=True , icon='c:\\code\\schema autoprefix\\AutoPrefix.ico')
coll = COLLECT(exe, Tree("c:\\code\\schema autoprefix"),
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=None,
               upx=True,
               name='AutoPrefix-x64')

Thanks!
Bryan

Ben Rousch

unread,
Apr 24, 2014, 4:31:13 PM4/24/14
to kivy-...@googlegroups.com
Correct. You need to run pyinstaller from the same environment that runs your app correctly. It uses the environment to guess at what things you need included in your package. Also note that your app must run correctly for pyinstaller to package it.

Bryan Lott

unread,
Apr 24, 2014, 5:22:03 PM4/24/14
to kivy-...@googlegroups.com
Nevermind... I was able to get it to build correctly using the precompiled x64 kivy without running kivy.bat.  I must have missed something in my spec file.  The current one (for onefile mode) is as follows:

# -*- mode: python -*-
from kivy.tools.packaging.pyinstaller_hooks import install_hooks
install_hooks(globals())
a = Analysis(['c:\\code\\schema autoprefix\\SchemaAutoprefix.py'],
             pathex=['C:\\code\\Schema Autoprefix'],
             hiddenimports=[],
             runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='AutoPrefix-x64.exe',
          debug=False,
          strip=None,
          upx=True,
          console=True , icon='c:\\code\\schema autoprefix\\AutoPrefix.ico')
coll = COLLECT(exe, Tree("c:\\code\\schema autoprefix"),
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=None,
               upx=True,
               name='AutoPrefix-x64')

As a final note for anyone mucking with packaging cx_Oracle, it needs to be packaged using the same bit version of oracle (32 or 64) as python and cx_Oracle.
Thanks for your help Ben!
Bryan
Reply all
Reply to author
Forward
0 new messages