@@ -154,6 +154,19 @@ for package in project_packages:
154154# Add parent packages to ensure they are included
155155all_hiddenimports .extend (['iotdb' , 'iotdb.ainode' ])
156156
157+ # Fix circular import issues in scipy.stats
158+ # scipy.stats has circular imports that can cause issues in PyInstaller
159+ # We need to ensure _stats is imported before scipy.stats tries to import it
160+ # This helps resolve the "partially initialized module" error
161+ scipy_stats_critical_modules = [
162+ 'scipy.stats._stats' , # Core stats module, must be imported first
163+ 'scipy.stats._stats_py' , # Python implementation
164+ 'scipy.stats._continuous_distns' , # Continuous distributions
165+ 'scipy.stats._discrete_distns' , # Discrete distributions
166+ 'scipy.stats.distributions' , # Distribution base classes
167+ ]
168+ all_hiddenimports .extend (scipy_stats_critical_modules )
169+
157170# Multiprocessing support for PyInstaller
158171# When using multiprocessing with PyInstaller, we need to ensure proper handling
159172multiprocessing_modules = [
@@ -212,7 +225,9 @@ a = Analysis(
212225 win_no_prefer_redirects = False ,
213226 win_private_assemblies = False ,
214227 cipher = block_cipher ,
215- noarchive = True , # Set to True to speed up startup - files are not archived into PYZ
228+ noarchive = False , # Set to False to avoid circular import issues with scipy.stats
229+ # When noarchive=True, modules are loaded as separate files which can cause
230+ # circular import issues. Using PYZ archive helps PyInstaller handle module loading order better.
216231)
217232
218233# Package all PYZ files
0 commit comments