I am trying to package a code almost 2kb size for linux using PyIntaller, package size is almost 250mb, according to code there is nothing special is imported. How to reduce this size? i am new to packaging all other codes i tried have same package size, here are my imports.
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color, Line
from kivy.uix.floatlayout import FloatLayout
import math
from math import cos, sin, pi
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import NumericProperty
import datetime
You could try running pyinstaller
in a different virtual environment.
To do so on Linux.
In a shell:
Create an environment with virtualenv env_name
- This will create
a "env_name" folder in your home directory
Activate the virtual environment with source activate env_name
Now you are in an environment whith no installed libraries
pip install cython==0.26
- Latest version is 0.27.3, but kivy 1.10 failed to compile while using that, this could change in the futurepip install kivy
env_name/bin/pyinstaller script.py
- This is needed since, by running pyinstaller
you would use the one in your original python installationThis should resonably reduce the amount of unneeded libraries in the package, just make sure you don't forget to install anything
Also, notice i didn't use sudo in the pip install
commands, that's because you don't need it inside the virtual environment, and using it could compromise the result