'cx_Freeze larger build size using fresh virtual env than system env

I am building a PyQt5-based project using cx_Freeze and am getting a larger lib size when building using a fresh virtual env (with only packages from requirements.txt installed), than using the system env (not Anaconda).

This seems to come down to how PyQt5 is differently packaged between in the two scenarios.

When building using a fresh virtual env, cx_Freeze seems unable to filter through which PyQt5 components to include (total 201.2 MiB from PyQt5); where building with the system env the included PyQt5 libs are better selected (total 25.9 MiB from PyQt5).

Why would building from a fresh virtual env inhibit cx_Freeze from better filtering PyQt5 components?

Below is the script used to build from a virtual env:

python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
python setup.py build
deactivate

And from the system env:

python setup.py build


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source