Python Forum
Pyinstaller distribution file seems too large
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyinstaller distribution file seems too large
#1
I ran pyinstaller on an app that has the following imports plus a small database and datepicker. I zipped the distribution file and it was 500MB. Is pyinstaller adding things it does not need?

from sqlite3 import dbapi2
#from tkinter import INSERT
#from turtle import down
from typing import Text, final
from unicodedata import name
from urllib.parse import parse_qs
import kivy
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.app import App
from kivy.uix.tabbedpanel import TabbedPanelHeader
from kivy.uix.button import Button
from kivy.uix.stacklayout import StackLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
import sqlite3
from kivy.clock import Clock
#from functools import partial
#from kivy.uix.dropdown import DropDown
#from kivy.base import runTouchApp
from kivy.uix.spinner import Spinner
from kivy.graphics import Color,Rectangle,Triangle,Ellipse
from kivy.uix.screenmanager import ScreenManager, Screen,NoTransition
#from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.gridlayout import GridLayout
from datetime import date
#from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.popup import Popup
from kivy.uix.scrollview import ScrollView
from kivy.core.window import Window
from kivy.config import Config
from kivy.uix.togglebutton import ToggleButton

from calandar_ui import DatePicker

from datetime import datetime
from datetime import timedelta
Reply
#2
since most of the clutter is with kivy.uix, Id do:
import kivy.uix as kuix
import kivy.graphics as kgraphics

# then if you need to use, for instance,  ScreenManager do:
... kuix.screenmanager.ScreenManager(...)

# or Rectangle
... kgraphics.Rectangle(...)
that makes only one import per submodule
Reply
#3
(Mar-31-2022, 02:04 AM)hammer Wrote: Is pyinstaller adding things it does not need?

Yes it does.

If I use pyinstaller in Linux, modules that are not required are also included when using PyQt5, no matter what is specified as import in the python file.

With Gtk it's even worse, there pyinstaller bundles the complete themes and icons folders together so that the folder created ends up being more than 1GB in size.
Reply
#4
Thank you.
For clarification, you are saying if i change the import to an alias(kuix) the instance reads:
#where i have 
btn=Button(...)
#would read
btn=kuix.button.Button(...)

Also, looking at my imports do i still need line 7 (import kivy) with all the other specific import statements?
Reply
#5
Look at this post.
So i build in a virtual environment to have control over dependencies.
See that size for the whole build is 23.4MB this with Pandas working.

kivy may need to pull in a more stuff needed from OS.
I have not testet Pytinstaller with Kivy,when i build a simple app with Kivy the .apk file was about 16MB.
This .apk file is all that the Phone need to install and run the full Kivy app.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  distribution fit Glaucio 1 237 Apr-07-2024, 12:30 AM
Last Post: Larz60+
  Weight Distribution 11drk9 11 696 Mar-13-2024, 06:08 AM
Last Post: Pedroski55
Information Best distribution method inovermyhead100 0 566 Jul-19-2023, 07:39 AM
Last Post: inovermyhead100
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 3,394 Jun-27-2023, 01:17 PM
Last Post: diver999
  Converted EXE file size is too large Rajasekaran 0 1,528 Mar-30-2023, 11:50 AM
Last Post: Rajasekaran
  validate large json file with millions of records in batches herobpv 3 1,283 Dec-10-2022, 10:36 PM
Last Post: bowlofred
  How do I use a whl puython distribution? barryjo 6 1,799 Aug-15-2022, 03:00 AM
Last Post: barryjo
  Initializing, reading and updating a large JSON file medatib531 0 1,799 Mar-10-2022, 07:58 PM
Last Post: medatib531
  problem with pyinstaller to create an executable file atlass218 0 2,576 May-15-2021, 11:01 AM
Last Post: atlass218
  Coin Toss - Distribution lasek723 6 3,124 Oct-04-2020, 01:36 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020