title: Pyinstaller onefile Executable Incredibly Huge and Slow
body: <p>I know I'm not the first to ask, but the other answers on the forum could not help me, so I'm asking. I have a short (181 line) python script that only has the imports</p>
  
  <p><code>import numpy as np
  import matplotlib.pyplot as plt
  from matplotlib.widgets import Slider, RadioButtons</code></p>
  
  <p>and runs up a interactive math tool with sliders and radio buttons. But when I built it with pyinstaller, I end up with a massive (90 MB) dist folder that appears to include all sorts of unnecessary packages like babel and cryptography. The executable inside takes around 5 seconds or so to actually display the figure. When I run it with the --onefile option, things seem no better, as I get a 43 MB executable that takes even longer, about 10 seconds, to display the figure.</p>
  
  <p>I'm prety sure it's not the script's fault because in Spyder, it takes less than a second to open up. I'm suspecting that it is because of all the extraneous packages. If so, how do I get pyinstaller to exclude them, and if not, then what is the likely issue? Thanks.</p>
  
  <p>EDIT: Also, I am doing all of this in a conda virtual environment, which I read somewhere should already help to make pyinstaller's executable smaller. After creating the environment, the only packages I directly installed were pyinstaller, spyder, numpy, and matplotlib.</p>