84922

Problems with PyInstaller

Question:

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:

import geopandas

However running pyinstaller throwaway.py does not work. It appears to have problems with PyQt5 which only matplotlib imports.

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:

This 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.

Hopefully the 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.py and 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>

Recommend

  • No console.log to STDOUT when running “npm test” (jest)
  • To set blinking effect on button in XAML
  • using UTF-8 characters in JAVA variable-names
  • Dynamic attributes in a jsp tag
  • What resolution programmers will get in Macbook Pro Retina
  • Using Scala reflection with Java reflection
  • symfony 1.4 using post validator in New action throws error
  • Use Iframe to embed csv and allow user to search from it
  • Detect Boolean value changes inside Thread
  • Google Apps Script Async function execution on Server side
  • Where is located the Unlocking Xib files option 'Reset Locking Control' (for 'Localiz
  • How can I overcome late binding in Active Directory search
  • Python SKLearn: How to Get Feature Names After OneHotEncoder?
  • Linq-to-SQL to search only DATE portions of a date
  • Error with Using jQuery to POST Form Data to an ASP.NET ASMX AJAX Web Service
  • Intent-Filter within a Service
  • File structure for PHP-based website
  • Installation failed for laravel/lumen-installer: guzzlehttp/guzzle locked at 6.3.0
  • Covert RFC3339 DateTime to Date in java [duplicate]
  • NOTE or WARNING from package check when README.md includes images
  • Retrieve 3rd MAX salary in Hive
  • Anaconda + Apache + mod_wsgi + Ubuntu
  • javax.net.ssl.SSLException: SSL handshake aborted Connection reset by peer while calling webservice
  • Defer unused CSS
  • Create .java file and compile it to a .class file at runtime
  • Javascript inside HTML import not affecting imported HTML
  • playing mp3 from nsbundle
  • Keep rows with certain values always at the bottom while sorting in jquery tablesorter plugin
  • Splitting ReportLab table across PDF page (side by side)?
  • How to create subsets of a single set of elements with XSLT?
  • Multiplying polynomials/simplifying like terms
  • How to use Kaminari pagination gem with Sinatra and Mongoid?
  • Comparing variables with strings bash
  • How to get rgb from transparent pixel in js
  • calling IO Operations from thread in ruby c extension will cause ruby to hang
  • Angular 4: Responsive Grid List
  • Angular FormGroup won't update it's value immediately after patchValue or setValue
  • Write to .csv file with PHP (Commas in Data Error)
  • XSLT Transformation to validate rules in XML document