Stylique commited on
Commit
2028832
·
verified ·
1 Parent(s): 29a3bb4

Upload 4 files

Browse files
Files changed (1) hide show
  1. post_install.py +45 -4
post_install.py CHANGED
@@ -66,10 +66,27 @@ def install_torch_sparse():
66
 
67
  print(f"PyTorch base version: {pytorch_base}, CUDA: {cuda_version}")
68
 
69
- # Store version info for later use
70
- global PYTORCH_VERSION, CUDA_VERSION
71
- PYTORCH_VERSION = pytorch_base
72
- CUDA_VERSION = cuda_version
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  except ImportError:
75
  print("PyTorch not found, installing default version...")
@@ -127,6 +144,18 @@ def install_torch_sparse():
127
  print("Successfully installed torch-sparse with alternative version")
128
  return True
129
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  return False
131
 
132
  def install_torch_scatter():
@@ -177,6 +206,18 @@ def install_torch_scatter():
177
  print("Successfully installed torch-scatter with alternative version")
178
  return True
179
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  return False
181
 
182
  def install_nvdiffrast():
 
66
 
67
  print(f"PyTorch base version: {pytorch_base}, CUDA: {cuda_version}")
68
 
69
+ # Check if we have a very recent PyTorch version that might not have compatible wheels
70
+ if pytorch_base.startswith("2.7"):
71
+ print("PyTorch 2.7.x detected - this is very recent and may not have compatible torch-sparse/torch-scatter wheels")
72
+ print("Attempting to install a more compatible PyTorch version...")
73
+
74
+ # Try to install PyTorch 2.0.1 which has known compatible wheels
75
+ if run_command("pip install --force-reinstall torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu117"):
76
+ print("Successfully installed PyTorch 2.0.1+cu117")
77
+ global PYTORCH_VERSION, CUDA_VERSION
78
+ PYTORCH_VERSION = "2.0.1"
79
+ CUDA_VERSION = "cu117"
80
+ else:
81
+ print("Failed to install PyTorch 2.0.1, will try to work with current version")
82
+ global PYTORCH_VERSION, CUDA_VERSION
83
+ PYTORCH_VERSION = pytorch_base
84
+ CUDA_VERSION = cuda_version
85
+ else:
86
+ # Store version info for later use
87
+ global PYTORCH_VERSION, CUDA_VERSION
88
+ PYTORCH_VERSION = pytorch_base
89
+ CUDA_VERSION = cuda_version
90
 
91
  except ImportError:
92
  print("PyTorch not found, installing default version...")
 
144
  print("Successfully installed torch-sparse with alternative version")
145
  return True
146
 
147
+ # Try installing with --no-build-isolation
148
+ print("Trying torch-sparse installation with --no-build-isolation...")
149
+ if run_command(f"pip install torch-sparse -f {wheel_url} --no-build-isolation"):
150
+ print("Successfully installed torch-sparse with --no-build-isolation")
151
+ return True
152
+
153
+ # Try installing from source with --no-build-isolation
154
+ print("Trying torch-sparse installation from source...")
155
+ if run_command("pip install torch-sparse --no-build-isolation"):
156
+ print("Successfully installed torch-sparse from source")
157
+ return True
158
+
159
  return False
160
 
161
  def install_torch_scatter():
 
206
  print("Successfully installed torch-scatter with alternative version")
207
  return True
208
 
209
+ # Try installing with --no-build-isolation
210
+ print("Trying torch-scatter installation with --no-build-isolation...")
211
+ if run_command(f"pip install torch-scatter -f {wheel_url} --no-build-isolation"):
212
+ print("Successfully installed torch-scatter with --no-build-isolation")
213
+ return True
214
+
215
+ # Try installing from source with --no-build-isolation
216
+ print("Trying torch-scatter installation from source...")
217
+ if run_command("pip install torch-scatter --no-build-isolation"):
218
+ print("Successfully installed torch-scatter from source")
219
+ return True
220
+
221
  return False
222
 
223
  def install_nvdiffrast():