python - PyInstaller Packages for kivy -



python - PyInstaller Packages for kivy -

i have tried build bundle out of kivy application using pyinstaller. goal create bundle can execute on linux (ubuntu 14.04 64bit) , re-create other linux systems well.

i tried execute pyinstaller whole night, tried various things , in end succeeded in creating bundle own system. first i'd know did functionally bundle app.

my main.spec file looks this:

# part kivy.tools.packaging.pyinstaller_hooks import install_hooks install_hooks(globals()) # -*- mode: python -*- # part b pyinstaller.hooks.hookutils import exec_statement hiddenimports = ['pysqlite2', 'mysqldb', 'psycopg2'] databases = exec_statement("import sqlalchemy.databases; print sqlalchemy.databases.__all__") databases = eval(databases.strip()) n in databases: hiddenimports.append("sqlalchemy.databases." + n) version = exec_statement('import sqlalchemy; print sqlalchemy.__version__') is_alch06 = version >= '0.6' if is_alch06: dialects = exec_statement("import sqlalchemy.dialects; print sqlalchemy.dialects.__all__") dialects = eval(dialects.strip()) n in databases: hiddenimports.append("sqlalchemy.dialects." + n) block_cipher = none # part c = analysis(['main.py'], pathex=['/home/grafgustav/python/icchp/accessmail/src','/'], hiddenimports=[], cipher=block_cipher) pyz = pyz(a.pure, cipher=block_cipher) exe = exe(pyz, a.scripts, exclude_binaries=true, name='main', debug=false, strip=none, upx=true, console=true ) coll = collect(exe, tree("/home/grafgustav/python/icchp/accessmail"), a.binaries, #..., a.zipfiles, a.datas, strip=none, upx=true, name='main', )

while understand why part b redundant (i copied part somewhere in internet) , part gets finished hooks kivy, not quite understand why not pack whole application i'd to.

as understand it, hooks used include libraries not straight imported, rather implicitly or during runtime. hidden-imports.

the main problem missing parts in resulting package. there folder "gui" within whole src-directory contains kivy-specific *.kv files. src folder containing gui folder included in resulting package, *.kv files still missing when seek start program. tried re-create gui folder same folder packaged "main" located @ , *.kv files not missing anymore. why pyinstaller re-create whole src folder fails observe gui folder properly? next error related sqlalchemy. since i've added sqlalchemy hooks figured packaged application not able find data.db utilize store data. 1 located 1 folder above main.py packaging. included in result, not in right position. if take data.db , re-create 1 folder above resulted main, error resolved well. final error, stopped bundle working caused 1 time again kivy-specific stuff. error message said, file [package directory]/kivy/data/style.kv missing. there not folder "kivy". searched file in kivy sources, copied right directory , works on system. wondering, why have re-create these files resulting directory manually. how can tell pyinstaller include these files beforehand? works on scheme (where packed it), neither on sec scheme (ubuntu 12.04lts 64-bit, error wrong opengl version), on testsystem (a fedora, no error @ all, main not executed) or on computers in university (debian 3.2.57 64-bit, `./main: /lib/x86_64-linux-gnu/libc.so.6: version glibc_2.14 not found (required /libz.so.1).

my friend used pyinstaller on windows system, had quite issues (he had add together above mentioned files/folders manually bundle well) in end worked on win7 , win8 as fine.

how can utilize pyinstaller create executable files other linux-systems on own system? , did main.spec file? or there maybe improve way create executable python applications?

i'm not expert, i'll share know

adding folders resulting package:

now wondering, why have re-create these files resulting directory manually. how can tell pyinstaller include these files beforehand?

when defining binaries on collect part, create phone call tree(), should made prefix parameter, pyinstaller know set folder accessmail in relation 'src' folder:

tree("/home/grafgustav/python/icchp/accessmail", prefix='..')

but never tryed '..' prefix, must test it.

adding files resulting package:

the packaged application not able find data.db utilize store data. 1 located 1 folder above main.py packaging. included in result, not in right position.

to add together arbitrary file binaries, need create tuple 3 values this:

a.binaries += [(file_address, file_result_address, 'data')]

the file_result_address file remain on resulting package.

to add together more files, add together more tuples between "[ ]":

[(addr,addr,type), (addr,addr,type), ...]

making work on several systems:

the first tip can give seek compile on 32bits system, it'll work on 32 , 64 bits systems.

as suggested on section 3 of this post might seek remove scheme libraries bundle , add together them dependencies, utilize native libraries those. link above provides python function job within .spec.

making single binary instead of folder dependencies:

how can utilize pyinstaller create executable files other linux-systems on own system?

if want single binary file output instead of folder dependencies on it, need create .spec file --onefile option. can re-create relevant parts code after that:

pyinstaller --onefile myscript.py

you can more info on official pyinstaller documentation, helped me lot.

i hope helps.

python packaging kivy pyinstaller

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -