Python Forum
[redistribution] Reduce number + size of dependencies?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[redistribution] Reduce number + size of dependencies?
#1
Question 
Hello,

Using…
pyinstaller --clean myscript.py
… I notice that a simple script running Python 3.12.0 that just reads a URL from the clipboard and then launches a CLI application to download a video from the Net needs 100MB worth of dependencies :-/

Is there a way to trim the fat, or are they necessarily all neeeded? For instance, why does a command-line Python script requires PyQt5 and its 80MB module?

FWIW, here's the modules the script imports:
import subprocess
import shlex
import sys
import pyperclip
from os import system
import re
Thank you.

The sub-directory _internal contains those files + subdirs:
api-ms-win-core-console-l1-1-0.dll
api-ms-win-core-datetime-l1-1-0.dll
api-ms-win-core-debug-l1-1-0.dll
api-ms-win-core-errorhandling-l1-1-0.dll
api-ms-win-core-fibers-l1-1-0.dll
api-ms-win-core-file-l1-1-0.dll
api-ms-win-core-file-l1-2-0.dll
api-ms-win-core-file-l2-1-0.dll
api-ms-win-core-handle-l1-1-0.dll
api-ms-win-core-heap-l1-1-0.dll
api-ms-win-core-interlocked-l1-1-0.dll
api-ms-win-core-libraryloader-l1-1-0.dll
api-ms-win-core-localization-l1-2-0.dll
api-ms-win-core-memory-l1-1-0.dll
api-ms-win-core-namedpipe-l1-1-0.dll
api-ms-win-core-processenvironment-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-1.dll
api-ms-win-core-profile-l1-1-0.dll
api-ms-win-core-rtlsupport-l1-1-0.dll
api-ms-win-core-string-l1-1-0.dll
api-ms-win-core-synch-l1-1-0.dll
api-ms-win-core-synch-l1-2-0.dll
api-ms-win-core-sysinfo-l1-1-0.dll
api-ms-win-core-timezone-l1-1-0.dll
api-ms-win-core-util-l1-1-0.dll
api-ms-win-crt-conio-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-process-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
base_library.zip
libcrypto-3.dll
libffi-8.dll
list.txt
PyQt5
python3.dll
python312.dll
select.pyd
ucrtbase.dll
unicodedata.pyd
VCRUNTIME140.dll
VCRUNTIME140_1.dll
_bz2.pyd
_ctypes.pyd
_decimal.pyd
_hashlib.pyd
_lzma.pyd
_socket.pyd
_wmi.pyd
Reply
#2
Uninstalling the PyQT5 module which I installed once but never used removed most of the cruft (80MB), although pyinstaller shouldn't have included it in the first place.
Reply
#3
Always build in virtual environment with only needed packages.
Same as advice as i give here a long time ago.
Gribouillis likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  reduce nested for-loops Phaze90 11 5,019 Mar-16-2023, 06:28 PM
Last Post: ndc85430
  Adding values with reduce() function from the list of tuples kinimod 10 5,373 Jan-24-2023, 08:22 AM
Last Post: perfringo
  Is it possible to see dependencies before installing a package? quazirfan 4 2,487 Dec-06-2022, 02:50 PM
Last Post: snippsat
  How can histogram bins be separated and reduce number of labels printed on x-axis? cadena 1 1,885 Sep-07-2022, 09:47 AM
Last Post: Larz60+
  How do I reduce the time to Invoke Macro via Python? JaneTan 1 2,722 Dec-28-2020, 06:46 AM
Last Post: buran
  Managing dependencies with pipenv t4keheart 6 4,605 Aug-05-2020, 12:39 AM
Last Post: t4keheart
  How to reduce the following code to run in sequence? Giggel 4 3,509 Jun-28-2020, 01:31 AM
Last Post: Giggel
  Easier way to manage dependencies? Tylersuard 2 3,012 Jan-01-2020, 09:19 PM
Last Post: Tylersuard
  Why the multithread does not reduce the execution time? Nicely 2 3,348 Nov-23-2019, 02:28 PM
Last Post: Nicely
  Help to reduce time to execute the code prakash52kar 1 2,803 Oct-14-2019, 10:56 AM
Last Post: scidam

Forum Jump:

User Panel Messages

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