I would like to bundle an application into an executable using PyInstaller. I am having issues because of the
geopandas library. Currently my script
throwaway.py contains only the following import:
pyinstaller throwaway.py does not work. It appears to have problems with
PyQt5 which only
The log for
pyinstalleris too long to include here however the following shows the last exception encountered:
Exception: Cannot find existing PyQt5 plugin directories Paths checked: c:/qt/qt_1489878162099/_b_env/Library/plugins
I am not sure how to approach this, but there are a couple of conceptual options:<ul><li>Find a way to exclude the geopandas import of matplotlib. I am not using matplotlib so I don't really need it to be packaged in the first place</li> <li>Figure out why this problem is occuring and prevent/fix it</li> </ul>
Could anyone please help? Thanks a lot!Answer1:
pyinstaller -y -d --clean throwaway.py works for me.
<a href="https://i.stack.imgur.com/qSrsg.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/qSrsg.png" data-original="https://i.stack.imgur.com/qSrsg.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>
Also, check this <a href="https://stackoverflow.com/questions/51662773/cannot-import-geopandas-with-pyinstaller-executable-despite-running-fine-in-th" rel="nofollow">question</a>.
There is an issue with the recursing limit, stated <a href="https://stackoverflow.com/questions/38977929/pyinstaller-creating-exe-runtimeerror-maximum-recursion-depth-exceeded-while-ca/42419584#42419584" rel="nofollow">here</a>. Try to increase it like this:
import sys sys.setrecursionlimit(5000)Answer2:
I solved this problem by downloading the development version of
pyinstaller as follows:
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
I got the above from <a href="https://github.com/pyinstaller/pyinstaller/issues/3750" rel="nofollow">this link</a>. The current
conda-forge distribution of
pyinstaller still does not include <a href="https://stackoverflow.com/questions/52376313/converting-py-file-to-exe-cannot-find-existing-pyqt5-plugin-directories" rel="nofollow">this change</a> which is included in the development version. The code prior to that change is what was causing the error in the question to occur.
conda-forge distribution will soon come to incorporate this into the main distribution.
So basically if you are experiencing this problem you have two choices:<ul><li>Install development version of PyInstaller and use that</li> <li>Manually go inside the
~\anaconda3\Lib\site-packages\PyInstaller\utils\hooks\qt.pyand modify the file as indicated <a href="https://stackoverflow.com/questions/52376313/converting-py-file-to-exe-cannot-find-existing-pyqt5-plugin-directories" rel="nofollow">here</a></li> </ul>