Merge pull request #6 from DenisKochetov/linux-install

fix spconv cuda parsing
This commit is contained in:
DenisKochetov
2025-06-13 12:36:35 +03:00
committed by GitHub
2 changed files with 34 additions and 5 deletions
+22 -3
View File
@@ -252,7 +252,7 @@ def install_platform_packages():
def install_spconv():
"""Simple spconv installation with correct CUDA version"""
# Check if spconv is already installed
# Check if spconv is already installed and working
try:
import spconv.core_cc
print("spconv is already installed and working")
@@ -265,8 +265,17 @@ def install_spconv():
print("No spconv_cuda_mapping in config, skipping spconv installation")
return True
# Convert CUDA_VERSION (e.g. cu128 -> 12.8) for lookup
cuda_version_for_lookup = CUDA_VERSION[2:3] + '.' + CUDA_VERSION[3:]
# Fix CUDA version parsing: cu128 -> 12.8, cu121 -> 12.1, cu118 -> 11.8
if len(CUDA_VERSION) >= 5: # e.g., cu128, cu121
major = CUDA_VERSION[2:-1] # cu128 -> 12, cu121 -> 12, cu118 -> 11
minor = CUDA_VERSION[-1] # cu128 -> 8, cu121 -> 1, cu118 -> 8
cuda_version_for_lookup = f"{major}.{minor}"
else:
print(f"Invalid CUDA_VERSION format: {CUDA_VERSION}")
return False
print(f"Detected CUDA version: {cuda_version_for_lookup}")
cuda_suffix = build_config.spconv_cuda_mapping.get(cuda_version_for_lookup)
if not cuda_suffix:
@@ -294,6 +303,16 @@ def install_spconv():
print(f"spconv installed but verification failed: {e}")
return False
def check_spconv_after_wheels():
"""Check if spconv works after wheels installation"""
try:
import spconv.core_cc
print("spconv is working after wheels installation")
return True
except ImportError:
print("spconv not working, will install from mapping")
return False
def wheels_dir_exists_and_not_empty(builds_dir):
if not os.path.exists(builds_dir):
return False
+12 -2
View File
@@ -23,6 +23,7 @@ try:
install_remote_packages,
install_platform_packages,
install_spconv,
check_spconv_after_wheels,
wheels_dir_exists_and_not_empty,
build_config,
PYTHON_PATH,
@@ -142,8 +143,12 @@ try:
# Step 1: Try wheels first
wheels_success = try_wheels_first_approach()
# Step 2: Install missing packages (like spconv)
spconv_success = install_spconv()
# Step 2: Check if spconv works after wheels, install if needed
if wheels_success and check_spconv_after_wheels():
spconv_success = True
else:
# Install spconv using CUDA mapping
spconv_success = install_spconv()
# Step 3: If wheels failed, try building
if not wheels_success:
@@ -152,6 +157,11 @@ try:
install_local_wheels(builds_dir)
wheels_success = True
cstr("Successfully built and installed wheels").msg.print()
# Check spconv again after building
if not check_spconv_after_wheels():
spconv_success = install_spconv()
else:
spconv_success = True
else:
cstr("Building wheels also failed").error.print()