Camais03 commited on
Commit
9ae9d32
·
verified ·
1 Parent(s): 9ea7e0b

Upload setup.py

Browse files

Fixed distutils dependency.

Files changed (1) hide show
  1. camie-tagger/app/setup.py +24 -1
camie-tagger/app/setup.py CHANGED
@@ -17,6 +17,13 @@ import time
17
  import webbrowser
18
 
19
  # Define the required packages
 
 
 
 
 
 
 
20
  REQUIRED_PACKAGES = [
21
  "streamlit>=1.21.0",
22
  "pillow>=9.0.0",
@@ -24,7 +31,6 @@ REQUIRED_PACKAGES = [
24
  # NumPy 2.x is not compatible with current PyTorch/torchvision builds
25
  "numpy==1.24.3",
26
  # Required for building Flash Attention
27
- "wheel>=0.38.0",
28
  "ninja>=1.10.0",
29
  "packaging>=20.0",
30
  ]
@@ -71,6 +77,12 @@ def check_python_version():
71
  return False
72
 
73
  print_colored(f"[OK] Python {version.major}.{version.minor}.{version.micro} detected", Colors.GREEN)
 
 
 
 
 
 
74
  return True
75
 
76
  def create_virtual_env():
@@ -295,6 +307,17 @@ def install_packages(cuda_version):
295
  except subprocess.CalledProcessError:
296
  print_colored("Warning: Failed to upgrade pip", Colors.WARNING)
297
 
 
 
 
 
 
 
 
 
 
 
 
298
  # Check NumPy version and install/upgrade if needed
299
  numpy_compatible = check_numpy_version()
300
 
 
17
  import webbrowser
18
 
19
  # Define the required packages
20
+ # Added setuptools and setuptools-distutils to fix distutils missing error
21
+ SETUPTOOLS_PACKAGES = [
22
+ "setuptools>=58.0.0",
23
+ "setuptools-distutils>=0.3.0",
24
+ "wheel>=0.38.0",
25
+ ]
26
+
27
  REQUIRED_PACKAGES = [
28
  "streamlit>=1.21.0",
29
  "pillow>=9.0.0",
 
31
  # NumPy 2.x is not compatible with current PyTorch/torchvision builds
32
  "numpy==1.24.3",
33
  # Required for building Flash Attention
 
34
  "ninja>=1.10.0",
35
  "packaging>=20.0",
36
  ]
 
77
  return False
78
 
79
  print_colored(f"[OK] Python {version.major}.{version.minor}.{version.micro} detected", Colors.GREEN)
80
+
81
+ # Add specific warning for Python 3.12+ about distutils
82
+ if version.major == 3 and version.minor >= 12:
83
+ print_colored("Notice: Python 3.12+ detected. distutils is no longer included in the standard library.", Colors.WARNING)
84
+ print_colored("This script will install setuptools-distutils to address this.", Colors.WARNING)
85
+
86
  return True
87
 
88
  def create_virtual_env():
 
307
  except subprocess.CalledProcessError:
308
  print_colored("Warning: Failed to upgrade pip", Colors.WARNING)
309
 
310
+ # Install setuptools packages first to ensure distutils is available
311
+ print_colored("\nInstalling setuptools and distutils...", Colors.BLUE)
312
+ for package in SETUPTOOLS_PACKAGES:
313
+ try:
314
+ print_colored(f"Installing {package}...", Colors.BLUE)
315
+ subprocess.run([pip_path, "install", package], check=True)
316
+ print_colored(f"[OK] Installed {package}", Colors.GREEN)
317
+ except subprocess.CalledProcessError as e:
318
+ print_colored(f"Warning: Issue installing {package}: {e}", Colors.WARNING)
319
+ print_colored("Continuing installation process...", Colors.BLUE)
320
+
321
  # Check NumPy version and install/upgrade if needed
322
  numpy_compatible = check_numpy_version()
323