-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
140 lines (114 loc) · 4.85 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<<<<<<< HEAD
"""
@Note:-
1. cx_Freeze 7.2.4 has compatibilty issues with python 3.13.0 so I used python 3.12.5 which works well with cx_Freeze 7.2.4
2. If you face this issue too then just uninstall python 3.13.0 and install python 3.12.5
@Note:- To create .exe file from .py file, follow these steps:
step-1: Do the necessary changes mentioned in the comments in this setup.py file only
step-2: Open powershell or cmd in your ML project folder and run the follwoing command:
python setup.py build
"""
import sys, os
from cx_Freeze import setup, Executable
# Give the absolute path of your .py file whose .exe you want
script_file = "E:\\Machine Learning\\Astro Entity Classifier\\Astro_Entity_Classifier.py"
# Include necessary files such as .ico file, .joblib files, your_own_defined_package.py(like here Outliers.py)
include_files = [
"E:\\Machine Learning\\Astro Entity Classifier\\astro_entity.ico",
"E:\\Machine Learning\\Astro Entity Classifier\\Model.joblib",
"E:\\Machine Learning\\Astro Entity Classifier\\pre_processor.joblib",
"E:\\Machine Learning\\Astro Entity Classifier\\Outliers.py",
"C:\\Windows\\System32\\vcomp140.dll" # Don't touch this line: It includes vcomp140.dll for sklearn
]
# Add the packages your project uses
packages = ["tkinter", "joblib", "pandas", "matplotlib", "numpy", "scienceplots", "sklearn", "ctypes"] # Don't touch ctypes
# Add the submodule you use in your project
build_exe_options = {
"include_files": include_files,
"packages": packages,
"includes": [
"sklearn.ensemble",
"sklearn.preprocessing",
"sklearn.impute",
"sklearn.model_selection",
"sklearn.pipeline",
"sklearn.metrics",
"sklearn.tree",
"pandas.plotting",
"matplotlib.pyplot",
"ctypes",
"tkinter.messagebox"
],
"include_msvcr": True # Don't touch this line
}
"""
Prevents black console from appearing
"""
base = None
if sys.platform == "win32":
base = "Win32GUI"
# Change application anme, version, dexcription and icon file absolute path
setup(
name="Astro Entity Classifier",
version="1.0",
description="A Tkinter GUI that uses an ML model trained on Bagging Classifier",
options={"build_exe": build_exe_options},
executables=[Executable(script_file, base=base, icon="E:\\Machine Learning\\Astro Entity Classifier\\astro_entity.ico")]
=======
"""
@Note:-
1. cx_Freeze 7.2.4 has compatibilty issues with python 3.13.0 so I used python 3.12.5 which works well with cx_Freeze 7.2.4
2. If you this issue too then just uninstall python 3.13.0 and install python 3.12.5
@Note:- To create .exe file from .py file, follow these steps:
step-1: Do the necessary changes mentioned in the comments in this setup.py file only
step-2: Open powershell or cmd in your ML project folder and run the follwoing command:
python setup.py build
"""
import sys, os
from cx_Freeze import setup, Executable
# Give the absolute path of your .py file whose .exe you want
script_file = "E:\\Machine Learning\\Astro Entity Classifier\\Astro_Entity_Classifier.py"
# Include necessary files such as .ico file, .joblib files, your_own_defined_package.py(like here Outliers.py)
include_files = [
"E:\\Machine Learning\\Astro Entity Classifier\\astro_entity.ico",
"E:\\Machine Learning\\Astro Entity Classifier\\Model.joblib",
"E:\\Machine Learning\\Astro Entity Classifier\\pre_processor.joblib",
"E:\\Machine Learning\\Astro Entity Classifier\\Outliers.py",
"C:\\Windows\\System32\\vcomp140.dll" # Don't touch this line: It includes vcomp140.dll for sklearn
]
# Add the packages your project uses
packages = ["tkinter", "joblib", "pandas", "matplotlib", "numpy", "scienceplots", "sklearn", "ctypes"] # Don't touch ctypes
# Add the submodule you use in your project
build_exe_options = {
"include_files": include_files,
"packages": packages,
"includes": [
"sklearn.ensemble",
"sklearn.preprocessing",
"sklearn.impute",
"sklearn.model_selection",
"sklearn.pipeline",
"sklearn.metrics",
"sklearn.tree",
"pandas.plotting",
"matplotlib.pyplot",
"ctypes",
"tkinter.messagebox"
],
"include_msvcr": True # Don't touch this line
}
"""
Prevents black console from appearing
"""
base = None
if sys.platform == "win32":
base = "Win32GUI"
# Change application anme, version, dexcription and icon file absolute path
setup(
name="Astro Entity Classifier",
version="1.0",
description="A Tkinter GUI that uses an ML model trained on Bagging Classifier",
options={"build_exe": build_exe_options},
executables=[Executable(script_file, base=base, icon="E:\\Machine Learning\\Astro Entity Classifier\\astro_entity.ico")]
>>>>>>> 4c06689ce079fb078cb564cdd988ca913f7008bb
)