Spaces:
Running
on
Zero
Running
on
Zero
Update setup_blender.sh
Browse files- setup_blender.sh +27 -5
setup_blender.sh
CHANGED
@@ -12,12 +12,22 @@ BLENDER_URL="https://download.blender.org/release/Blender${BLENDER_MAJOR_MINOR}/
|
|
12 |
INSTALL_DIR="/opt/blender-${BLENDER_VERSION}-linux-x64"
|
13 |
BLENDER_PY_EXEC="${INSTALL_DIR}/${BLENDER_MAJOR_MINOR}/python/bin/${BLENDER_PYTHON_VERSION}"
|
14 |
# Assuming unirig_requirements.txt is in the root directory alongside this script and app.py
|
15 |
-
# If UniRig repo is cloned first, adjust path e.g., "UniRig/unirig_requirements.txt"
|
16 |
UNIRIG_REQS_FILE="unirig_requirements.txt"
|
17 |
# Define the specific torch version and index URL (matching unirig_requirements.txt)
|
18 |
TORCH_VERSION="2.3.1"
|
19 |
TORCHVISION_VERSION="0.18.1"
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# --- Download and Extract Blender ---
|
23 |
echo "Downloading Blender ${BLENDER_VERSION}..."
|
@@ -54,7 +64,7 @@ echo "Upgrading pip for Blender Python..."
|
|
54 |
|
55 |
# --- Install PyTorch and Torchvision FIRST ---
|
56 |
# This is crucial because some packages (like torch-scatter) need torch during their own setup
|
57 |
-
echo "Installing PyTorch ${TORCH_VERSION} and Torchvision ${TORCHVISION_VERSION} first..."
|
58 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
59 |
torch==${TORCH_VERSION} \
|
60 |
torchvision==${TORCHVISION_VERSION} \
|
@@ -62,8 +72,19 @@ echo "Installing PyTorch ${TORCH_VERSION} and Torchvision ${TORCHVISION_VERSION}
|
|
62 |
|
63 |
echo "PyTorch and Torchvision installation complete."
|
64 |
|
65 |
-
# --- Install
|
66 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
echo "Installing remaining packages from ${UNIRIG_REQS_FILE}..."
|
68 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir -r "${UNIRIG_REQS_FILE}"
|
69 |
|
@@ -75,3 +96,4 @@ rm /tmp/${BLENDER_TARBALL}
|
|
75 |
echo "Cleanup complete."
|
76 |
|
77 |
echo "Blender setup finished successfully."
|
|
|
|
12 |
INSTALL_DIR="/opt/blender-${BLENDER_VERSION}-linux-x64"
|
13 |
BLENDER_PY_EXEC="${INSTALL_DIR}/${BLENDER_MAJOR_MINOR}/python/bin/${BLENDER_PYTHON_VERSION}"
|
14 |
# Assuming unirig_requirements.txt is in the root directory alongside this script and app.py
|
|
|
15 |
UNIRIG_REQS_FILE="unirig_requirements.txt"
|
16 |
# Define the specific torch version and index URL (matching unirig_requirements.txt)
|
17 |
TORCH_VERSION="2.3.1"
|
18 |
TORCHVISION_VERSION="0.18.1"
|
19 |
+
TORCH_CUDA_SUFFIX="cu121" # CUDA version suffix for wheels
|
20 |
+
TORCH_INDEX_URL="https://download.pytorch.org/whl/${TORCH_CUDA_SUFFIX}" # Make sure this matches your target CUDA
|
21 |
+
|
22 |
+
# PyTorch Geometric wheel URLs (Update these if versions change)
|
23 |
+
PYG_TORCH_VERSION_SUFFIX="2.3.1" # PyTorch version suffix in PyG URLs
|
24 |
+
PYG_PYTHON_VERSION="cp311" # Python version suffix
|
25 |
+
PYG_CUDA_SUFFIX="cu121" # CUDA version suffix
|
26 |
+
PYG_BASE_URL="https://data.pyg.org/whl/torch-${PYG_TORCH_VERSION_SUFFIX}+${PYG_CUDA_SUFFIX}"
|
27 |
+
# Find exact wheel names from the HTML pages if these links break
|
28 |
+
TORCH_SCATTER_WHL_URL="${PYG_BASE_URL}/torch_scatter-2.1.2+pt${PYG_TORCH_VERSION_SUFFIX/./}${PYG_CUDA_SUFFIX}-${PYG_PYTHON_VERSION}-${PYG_PYTHON_VERSION}-linux_x86_64.whl"
|
29 |
+
TORCH_CLUSTER_WHL_URL="${PYG_BASE_URL}/torch_cluster-1.6.3+pt${PYG_TORCH_VERSION_SUFFIX/./}${PYG_CUDA_SUFFIX}-${PYG_PYTHON_VERSION}-${PYG_PYTHON_VERSION}-linux_x86_64.whl"
|
30 |
+
|
31 |
|
32 |
# --- Download and Extract Blender ---
|
33 |
echo "Downloading Blender ${BLENDER_VERSION}..."
|
|
|
64 |
|
65 |
# --- Install PyTorch and Torchvision FIRST ---
|
66 |
# This is crucial because some packages (like torch-scatter) need torch during their own setup
|
67 |
+
echo "Installing PyTorch ${TORCH_VERSION} and Torchvision ${TORCHVISION_VERSION} first (CUDA: ${TORCH_CUDA_SUFFIX})..."
|
68 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
69 |
torch==${TORCH_VERSION} \
|
70 |
torchvision==${TORCHVISION_VERSION} \
|
|
|
72 |
|
73 |
echo "PyTorch and Torchvision installation complete."
|
74 |
|
75 |
+
# --- Install torch-scatter and torch-cluster using direct wheel URLs SECOND ---
|
76 |
+
# This avoids build issues by using pre-compiled wheels directly.
|
77 |
+
echo "Installing torch-scatter and torch-cluster from specific wheels..."
|
78 |
+
echo "Scatter wheel: ${TORCH_SCATTER_WHL_URL}"
|
79 |
+
echo "Cluster wheel: ${TORCH_CLUSTER_WHL_URL}"
|
80 |
+
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
81 |
+
"${TORCH_SCATTER_WHL_URL}" \
|
82 |
+
"${TORCH_CLUSTER_WHL_URL}"
|
83 |
+
|
84 |
+
echo "torch-scatter and torch-cluster installation complete."
|
85 |
+
|
86 |
+
# --- Install the rest of the packages from unirig_requirements.txt THIRD ---
|
87 |
+
# Pip will skip torch, torchvision, torch-scatter, torch-cluster if already installed.
|
88 |
echo "Installing remaining packages from ${UNIRIG_REQS_FILE}..."
|
89 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir -r "${UNIRIG_REQS_FILE}"
|
90 |
|
|
|
96 |
echo "Cleanup complete."
|
97 |
|
98 |
echo "Blender setup finished successfully."
|
99 |
+
|