Optional imports are the bane of systems like this:-(

Also, note that SciPy imports most of its sub-modules automatically, so if
you need one function, you get the whole thing.

Though in this case, it looks like you don’t need it at all, so that’s good.

Meanwhile, QT is huge, and you do need that, so you may have done all you
can.

I have always thought that a good way to do module finding would be to not
try to parse the source, but rather, run a test suite, and then dump
sys.modules and you’d have a list of every module that was actually used by
your application.

-CHB


Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115 <x-apple-data-detectors://6/1>       (206) 526-6317
main reception

On Mar 28, 2020, at 8:36 AM, Steve Barnes <[email protected]> wrote:



Abhishek,



Creating a venv and installing the packages that you list in the example
below I found that SciPy was not installed in the process, *so it is not a
declared dependency of any of them! * However, running `grin scipy` in the
venvs library directory I found a number of conditional imports of scipy –
so basically if you have it available it will be considered a, possibly
conditional, import and so will be included by pyinstaller *and most
similar packages* but if it is missing it almost certainly will not cause
an issue.



*You can see why I like venv for building my code into
executables/deliverables.*



Steve



*From:* [email protected] <[email protected]> *On
Behalf Of *abhishek bhatta
*Sent:* 28 March 2020 05:03
*To:* PyInstaller <[email protected]>
*Subject:* [PyInstaller] Re: Is there any way to specify which modules to
import?



Thanks Eric and Chris,



I understand that Pyinstaller is checking and importing the dependencies
but there must either be some bug with that part or I am missing something.



Here is the full scenario.

Here is all the imports I am using in my original code:

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#Import

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

import sys

import time

import socket, errno

import struct

import datetime as dt

from PyQt5.QtCore import *

from PyQt5.QtGui import *

from PyQt5.QtWidgets import *

from collections import OrderedDict

from functools import reduce

from math import *

from statistics import mean

from threading import Thread, Lock

import os

import fnmatch

import paramiko

import shutil

import subprocess

import win32process

import psutil

import winreg

import numpy as np



print("This is a test")

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#End

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



I saved it with the name "test.py".



If I try to compile this into an exe with the following command "*pyinstaller
--win-private-assemblies --win-no-prefer-redirects -w -F -n test.exe
test.py*"

The size of the exe comes up to 61.1 MB



Now if I just exclude scipy and execute the following command "*pyinstaller
--win-private-assemblies --win-no-prefer-redirects --exclude scipy -w -F -n
test.exe test.py*"

The size of the exe goes to 52.9 MB



*Ques: Why does Pyinstaller consider scipy as a necessary import?*







Thanks Steve,



I am going to look into the venv setup and only install the necessary
packages there to find out about any other issues.

Also, pylint is a good way to go as well.





Regards,

Abhishek Bhatta











-- 
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyinstaller/551c94ee-d187-47f8-8127-06e4273c3080%40googlegroups.com
<https://groups.google.com/d/msgid/pyinstaller/551c94ee-d187-47f8-8127-06e4273c3080%40googlegroups.com?utm_medium=email&utm_source=footer>
.

-- 
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyinstaller/VI1PR03MB4479FA5E85CDC5A4E5F55CB69BCD0%40VI1PR03MB4479.eurprd03.prod.outlook.com
<https://groups.google.com/d/msgid/pyinstaller/VI1PR03MB4479FA5E85CDC5A4E5F55CB69BCD0%40VI1PR03MB4479.eurprd03.prod.outlook.com?utm_medium=email&utm_source=footer>
.

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/CALGmxEKzcz7nEJG1aEpyRy%3DYiNfSAY9%2BpLmcc-mK9O%3DhOtjdHQ%40mail.gmail.com.

Reply via email to