Reputation: 401
So for my update module I have a progressbar system with tqdm.
from tqdm import tqdm
for i in tqdm(range(3)):
something()
I want my friends without python to use it, so I use PyInstaller. However, PyInstaller creates executables that are 50mb. I have used Py2EXE.net before, which gave me ~6-7MB .exe files. From the output log, I have guessed that it has decided to copy ALL of my site-packages, and I have about 200 packages.
How can I stop PyInstaller from copying all of my packages, and just copy tqdm?
Pastebin Output (Log Output did not fit here.)
Upvotes: 1
Views: 1623
Reputation: 3473
I have solved this issue by making sure to run pyinstaller
inside a virtual environment with all the required libraries included in.
Create and activate venv:
python3 -m venv venv
source venv/bin/activate
Install pyinstaller
and required libraries inside the venv:
pip install pyinstaller
Then bundle:
pyinstaller myfile.py --onefile
Upvotes: 0
Reputation: 367
I just ran into this specific problem. Tqdm library uses other large modules. If you read the verbose you'll see how many modules is loading. Effectively making your exe 50MB+~
Alternative with very light dependencies. You exe will be around 5MB provided no other large modules are imported by your script. progress module
Upvotes: 2