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]<mailto:[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.

Reply via email to