matrice-analytics 0.1.42__py3-none-any.whl → 0.1.43__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of matrice-analytics might be problematic. Click here for more details.

@@ -37,12 +37,18 @@ CLIPProcessor = None
37
37
  ir_files = None
38
38
  ir_as_file = None
39
39
 
40
+ # Track auto-installation status (singleton pattern to avoid repeated attempts)
41
+ _installation_attempted = False
42
+ _installation_successful = False
43
+ _installation_error = None
44
+
40
45
  try:
41
46
  import onnxruntime as ort
42
47
  from PIL import Image
43
48
  from transformers import CLIPProcessor
44
49
  from importlib.resources import files as ir_files, as_file as ir_as_file
45
50
  print("✓ CLIP dependencies available (onnxruntime, PIL, transformers)")
51
+ _installation_successful = True # Already available
46
52
  except ImportError as e:
47
53
  print(f"⚠ CLIP dependencies not available at import time: {e}")
48
54
  print("→ Will attempt auto-installation when color detection is first used")
@@ -54,10 +60,28 @@ def try_install_clip_dependencies():
54
60
  """
55
61
  Attempt to install missing CLIP dependencies.
56
62
  Only called when ClipProcessor is actually instantiated (lazy installation).
63
+ Uses singleton pattern to ensure installation only happens ONCE per session.
57
64
  Returns True if successful, False otherwise.
58
65
  """
66
+ global _installation_attempted, _installation_successful, _installation_error
67
+
68
+ # Check if we already attempted installation
69
+ if _installation_attempted:
70
+ if _installation_successful:
71
+ print("✓ CLIP dependencies already available (from previous installation)")
72
+ return True
73
+ else:
74
+ print(f"✗ CLIP dependencies installation already failed previously")
75
+ if _installation_error:
76
+ print(f" Previous error: {_installation_error}")
77
+ print("→ Skipping repeated installation attempt")
78
+ return False
79
+
80
+ # Mark that we're attempting installation (prevents concurrent attempts)
81
+ _installation_attempted = True
82
+
59
83
  print("→ Color detection is being used but dependencies are missing")
60
- print("→ Attempting auto-installation of missing packages...")
84
+ print("→ Attempting ONE-TIME auto-installation of missing packages...")
61
85
 
62
86
  import platform
63
87
  import subprocess
@@ -128,6 +152,19 @@ def try_install_clip_dependencies():
128
152
  else:
129
153
  print("→ transformers is installed but import failed (may be incompatible with torch version)")
130
154
 
155
+ # Check for tqdm (required by transformers)
156
+ try:
157
+ import tqdm
158
+ print("→ tqdm imported successfully")
159
+ except ImportError:
160
+ if not is_package_installed("tqdm"):
161
+ print("→ tqdm not found, adding to install list")
162
+ packages_to_install.append("tqdm")
163
+ else:
164
+ print("→ tqdm is installed but import failed")
165
+ # Reinstall tqdm if it's broken
166
+ packages_to_install.append("tqdm")
167
+
131
168
  if not packages_to_install:
132
169
  print("→ All packages are available, retrying import...")
133
170
  else:
@@ -146,10 +183,14 @@ def try_install_clip_dependencies():
146
183
  if result.returncode == 0:
147
184
  print(f" ✓ {package} installed successfully")
148
185
  else:
149
- print(f"Failed to install {package}: {result.stderr}")
186
+ error_msg = f"Failed to install {package}: {result.stderr}"
187
+ print(f" ✗ {error_msg}")
188
+ _installation_error = error_msg
150
189
  return False
151
190
  except Exception as install_error:
152
- print(f"Installation failed: {install_error}")
191
+ error_msg = f"Installation failed: {install_error}"
192
+ print(f"✗ {error_msg}")
193
+ _installation_error = error_msg
153
194
  return False
154
195
 
155
196
  # Retry imports after installation (or if packages were already installed)
@@ -194,8 +235,10 @@ def try_install_clip_dependencies():
194
235
 
195
236
  # Check if we have at least the critical dependencies
196
237
  if ort_module is None or PILImage is None or CLIPProc is None:
197
- print(f"Critical dependencies missing after installation attempt")
198
- print(f" Errors: {'; '.join(import_errors)}")
238
+ error_msg = f"Critical dependencies missing: {'; '.join(import_errors)}"
239
+ print(f" {error_msg}")
240
+ _installation_error = error_msg
241
+ _installation_successful = False
199
242
  return False
200
243
 
201
244
  # Update global variables with successfully imported modules
@@ -206,6 +249,8 @@ def try_install_clip_dependencies():
206
249
  globals()['ir_as_file'] = ir_as_file_module
207
250
 
208
251
  print("✓ CLIP dependencies imported successfully!")
252
+ _installation_successful = True
253
+ _installation_error = None
209
254
  return True
210
255
 
211
256
  def load_model_from_checkpoint(checkpoint_url: str, providers: Optional[List] = None):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_analytics
3
- Version: 0.1.42
3
+ Version: 0.1.43
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -166,7 +166,7 @@ matrice_analytics/post_processing/usecases/weld_defect_detection.py,sha256=b0dAJ
166
166
  matrice_analytics/post_processing/usecases/wildlife_monitoring.py,sha256=TMVHJ5GLezmqG7DywmqbLggqNXgpsb63MD7IR6kvDkk,43446
167
167
  matrice_analytics/post_processing/usecases/windmill_maintenance.py,sha256=G1eqo3Z-HYmGJ6oeZYrpZwhpvqQ9Lc_T-6S7BLBXHeA,40498
168
168
  matrice_analytics/post_processing/usecases/wound_segmentation.py,sha256=ehNX6VuWMB3xAnCySO3ra3Tf_5FUNg5LCSdq_91h374,38342
169
- matrice_analytics/post_processing/usecases/color/clip.py,sha256=3pA_Oaw3hnMcuuyZLG5-1w1Kt04H04AHGy2d8463mzg,25741
169
+ matrice_analytics/post_processing/usecases/color/clip.py,sha256=RW3XdsQR2oAMZUTTCCUPBSdAldgG3w4zki_S-hb4tVA,27561
170
170
  matrice_analytics/post_processing/usecases/color/color_map_utils.py,sha256=SP-AEVcjLmL8rxblu-ixqUJC2fqlcr7ab4hWo4Fcr_k,2677
171
171
  matrice_analytics/post_processing/usecases/color/color_mapper.py,sha256=nKPc28mJLlrl2HPua5EUUMweRRSI6WrrUBkeitTm7ms,17459
172
172
  matrice_analytics/post_processing/usecases/color/clip_processor/merges.txt,sha256=n9aR98gDkhDg_O0VhlRmxlgg0JtjmIsBdL_iXeKZBRo,524619
@@ -188,8 +188,8 @@ matrice_analytics/post_processing/utils/format_utils.py,sha256=UTF7A5h9j0_S12xH9
188
188
  matrice_analytics/post_processing/utils/geometry_utils.py,sha256=BWfdM6RsdJTTLR1GqkWfdwpjMEjTCJyuBxA4zVGKdfk,9623
189
189
  matrice_analytics/post_processing/utils/smoothing_utils.py,sha256=78U-yucAcjUiZ0NIAc9NOUSIT0PWP1cqyIPA_Fdrjp0,14699
190
190
  matrice_analytics/post_processing/utils/tracking_utils.py,sha256=rWxuotnJ3VLMHIBOud2KLcu4yZfDp7hVPWUtNAq_2xw,8288
191
- matrice_analytics-0.1.42.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
192
- matrice_analytics-0.1.42.dist-info/METADATA,sha256=OLJohdXLb8RHXTcSxR5eUb1fcj85xYhpceBOMFEXnj4,14378
193
- matrice_analytics-0.1.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
194
- matrice_analytics-0.1.42.dist-info/top_level.txt,sha256=STAPEU-e-rWTerXaspdi76T_eVRSrEfFpURSP7_Dt8E,18
195
- matrice_analytics-0.1.42.dist-info/RECORD,,
191
+ matrice_analytics-0.1.43.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
192
+ matrice_analytics-0.1.43.dist-info/METADATA,sha256=XEb8jt0ezecP_Phg22fCGsMBFToMhI2iSHb5FAahQhE,14378
193
+ matrice_analytics-0.1.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
194
+ matrice_analytics-0.1.43.dist-info/top_level.txt,sha256=STAPEU-e-rWTerXaspdi76T_eVRSrEfFpURSP7_Dt8E,18
195
+ matrice_analytics-0.1.43.dist-info/RECORD,,