build a .exe for Windows from a python 3 script importing theano with pyinstaller -


edit september, 2, 2017, 1pm

i managed build .exe pyinstaller after many episodes.

unfortunately failed deal ‘theano’ module (that required in case ‘pymc3’ module) , had modify .py files , give part of application. description below has 2 aims: first may help; second could me building .exe windows 7+, ‘theano’ module ?

reminder: python 3 script opens simple gui made qt designer in ‘.ui’ file , imports pyqtgraph (with pyqt5), pymc3 (and theano required pymc3), scipy, numpy, os, sys. distributed on machines windows 7+. tried build ‘.exe’ py2exe, cx_freeze, pynsist , pyinstaller (i opened , updated several posts, 1 still opened: build .exe windows python 3 script importing pyqtgraph , opening gui) failed. best result (with pyinstaller) described below after had give theano.

  • the command line ended is: pyinstaller —noupx —onefile —add-data “toto.ui;.” toto.py. strangely:

1 qt designer file ‘toto.ui’ not included , must distributed .exe. otherwise there error message when running .exe saying toto.ui not found;

2 ‘platforms’ directory ‘library/plugin’ directory of python environment must distributed along .exe. otherwise there error message when running .exe ‘this application has failed start because not find qt platform plugin windows’ (but there no error message pyinstaller when building !)

3 .exe 220mb big ! seems pyinstaller includes bunch of useless things during building.

  • pyqtgraph problem:

at first sight, module ‘pyqtgraph’ seems incompatible pyinstaller. indeed, when python code imports pyqtgraph, pyinstaller gives syntaxerror: ‘yield’ inside async function. seems me awkward (is bug in pyinstaller ?) because had impression forums related asynchronous generators compatible python 3.6, while pyinstaller works python 3.5- not compatible asynchronous generators… why pyinstaller use ? turns out bug-like feature disabled in new version of pyinstaller not released (and not installed default): pip install git+https://github.com/pyinstaller/pyinstaller, 9dogs (in comments). found may explicitly write os.environ[‘pyqtgraph_qt_lib'] = 'pyqt5’ or ‘pyqt4’ before importing pyqtgraph in py file(s)

  • theano problem:

theano turns out make several implicit imports not detected pyinstaller. building looks ok when running .exe error messages ‘no module theano.tensor.shared_randomstreams’. unfortunately failed use '--hidden-import' option of pyinstaller added explicitly imports in py file(s) (in example ’import theano.tensor.shared_randomstreams’ ).

but not end: after that, file ‘…\appdata\local\temp_mei35682\theano\gpuarray\blockgemv.c' missing, leading [4128] failed execute script. don’t know file , didn’t find information. gave , removed part of gui avoid theano. can me using theano pyinstaller ?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -