0

I have an application that transcripts audio to text and analyses that text looking for keywords using natural language processing. It has a lot of dependencies, so I was expecting a large file. But over 500mb is too large.

It has 510MB in size.

I'm using a pipenv environment to isolate the dependencies.

Here is the requirement file I froze with pip:

altgraph==0.17
certifi==2021.5.30
charset-normalizer==2.0.4
click==8.0.1
colorama==0.4.4
future==0.18.2
idna==3.2
joblib==1.0.1
nltk==3.6.2
numpy==1.21.2
pefile==2021.5.24
protobuf==3.17.3
PyAudio @ file:///D:/Downloads/Programs/Programming/PyAudio-0.2.11-cp39-cp39-win_amd64.whl
pydub==0.25.1
pyinstaller==4.5.1
pyinstaller-hooks-contrib==2021.3
pywin32-ctypes==0.2.0
regex==2021.8.28
requests==2.26.0
six==1.16.0
SpeechRecognition==3.8.1
stanza==1.2.3
torch==1.9.0
tqdm==4.62.2
typing-extensions==3.10.0.2
urllib3==1.26.6

Here are all my imports (in different scripts):

import speech_recognition as sr
from pathlib import Path
from pydub import AudioSegment
from pydub.utils import make_chunks, mediainfo
import math
import contextlib
import wave
import stanza
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords

Is there any way I can reduce the size of the executable?

Laila Campos
  • 801
  • 1
  • 8
  • 21
  • > "Over 500MB is too much." > "It has 510.806 KB in size." Which is it — 500MB or 500KB? – Alex Waygood Sep 05 '21 at 16:53
  • 1
    I believe it's 500MB. Anyways, you can try `--exclude-module` to exclude modules/packages you don't need. For example, the `_lzma.pyd` (`--exclude-module _lzma`) maybe your project doesn't need it? In addition, tkinter hook was always loaded, if you/your dependencies don't use tkinter, you can exclude it too. – gfdsweds Sep 06 '21 at 10:34
  • I fixed. It's 510MB. Sorry. – Laila Campos Sep 06 '21 at 11:18
  • @gfdsweds , I tried excluding _lzm.pyd and my app executable wouldn't even start afterwards. – Laila Campos Sep 06 '21 at 12:47

0 Answers0