Spaces:
Running
on
Zero
Running
on
Zero
Update setup_blender.sh
Browse files- setup_blender.sh +14 -4
setup_blender.sh
CHANGED
@@ -16,7 +16,12 @@ TORCH_VERSION="2.3.1"
|
|
16 |
TORCHVISION_VERSION="0.18.1"
|
17 |
TORCH_CUDA_SUFFIX="cu121"
|
18 |
TORCH_INDEX_URL="https://download.pytorch.org/whl/${TORCH_CUDA_SUFFIX}"
|
|
|
19 |
PYG_WHEEL_INDEX="https://data.pyg.org/whl/torch-2.3.0+cu121.html" # Compatible with 2.3.1
|
|
|
|
|
|
|
|
|
20 |
|
21 |
# --- Download and Extract Blender ---
|
22 |
echo "Downloading Blender ${BLENDER_VERSION}..."
|
@@ -36,28 +41,33 @@ echo "Symlink created."
|
|
36 |
# --- Install Dependencies into Blender's Python ---
|
37 |
echo "Installing dependencies into Blender's Python (${BLENDER_PYTHON_VERSION})..."
|
38 |
|
|
|
39 |
if [ ! -f "${BLENDER_PY_EXEC}" ]; then
|
40 |
echo "ERROR: Blender Python executable not found at ${BLENDER_PY_EXEC}!"
|
41 |
exit 1
|
42 |
fi
|
43 |
|
|
|
44 |
if [ ! -f "${UNIRIG_REQS_FILE}" ]; then
|
45 |
echo "ERROR: Requirements file not found at ${UNIRIG_REQS_FILE}!"
|
46 |
exit 1
|
47 |
fi
|
48 |
|
49 |
-
# Upgrade pip
|
50 |
echo "Upgrading pip for Blender Python..."
|
51 |
"${BLENDER_PY_EXEC}" -m pip install --upgrade pip setuptools wheel
|
52 |
|
53 |
-
# Install PyTorch and Torchvision first
|
54 |
echo "Installing PyTorch ${TORCH_VERSION} and Torchvision ${TORCHVISION_VERSION} (CUDA: ${TORCH_CUDA_SUFFIX})..."
|
|
|
55 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
56 |
torch==${TORCH_VERSION} \
|
57 |
torchvision==${TORCHVISION_VERSION} \
|
58 |
--index-url ${TORCH_INDEX_URL}
|
59 |
|
60 |
-
# Install remaining dependencies
|
|
|
|
|
61 |
echo "Installing remaining packages from ${UNIRIG_REQS_FILE} with PyG wheel index..."
|
62 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir -r "${UNIRIG_REQS_FILE}" -f ${PYG_WHEEL_INDEX}
|
63 |
|
@@ -68,4 +78,4 @@ echo "Cleaning up downloaded tarball..."
|
|
68 |
rm /tmp/${BLENDER_TARBALL}
|
69 |
echo "Cleanup complete."
|
70 |
|
71 |
-
echo "Blender setup finished successfully."
|
|
|
16 |
TORCHVISION_VERSION="0.18.1"
|
17 |
TORCH_CUDA_SUFFIX="cu121"
|
18 |
TORCH_INDEX_URL="https://download.pytorch.org/whl/${TORCH_CUDA_SUFFIX}"
|
19 |
+
# Define the PyG wheel index URL (use the one compatible with torch 2.3.1, even if named 2.3.0)
|
20 |
PYG_WHEEL_INDEX="https://data.pyg.org/whl/torch-2.3.0+cu121.html" # Compatible with 2.3.1
|
21 |
+
# Define CUDA Home (adjust if the path is different in the Space environment)
|
22 |
+
export CUDA_HOME=/usr/local/cuda
|
23 |
+
echo "Setting CUDA_HOME=${CUDA_HOME}"
|
24 |
+
|
25 |
|
26 |
# --- Download and Extract Blender ---
|
27 |
echo "Downloading Blender ${BLENDER_VERSION}..."
|
|
|
41 |
# --- Install Dependencies into Blender's Python ---
|
42 |
echo "Installing dependencies into Blender's Python (${BLENDER_PYTHON_VERSION})..."
|
43 |
|
44 |
+
# Check if Blender Python executable exists
|
45 |
if [ ! -f "${BLENDER_PY_EXEC}" ]; then
|
46 |
echo "ERROR: Blender Python executable not found at ${BLENDER_PY_EXEC}!"
|
47 |
exit 1
|
48 |
fi
|
49 |
|
50 |
+
# Check if the requirements file exists
|
51 |
if [ ! -f "${UNIRIG_REQS_FILE}" ]; then
|
52 |
echo "ERROR: Requirements file not found at ${UNIRIG_REQS_FILE}!"
|
53 |
exit 1
|
54 |
fi
|
55 |
|
56 |
+
# Upgrade pip, setuptools, and wheel within Blender's Python environment
|
57 |
echo "Upgrading pip for Blender Python..."
|
58 |
"${BLENDER_PY_EXEC}" -m pip install --upgrade pip setuptools wheel
|
59 |
|
60 |
+
# Install PyTorch and Torchvision first using the specified index URL
|
61 |
echo "Installing PyTorch ${TORCH_VERSION} and Torchvision ${TORCHVISION_VERSION} (CUDA: ${TORCH_CUDA_SUFFIX})..."
|
62 |
+
# Ensure CUDA_HOME is available for this step too if needed by torch install hooks
|
63 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
64 |
torch==${TORCH_VERSION} \
|
65 |
torchvision==${TORCHVISION_VERSION} \
|
66 |
--index-url ${TORCH_INDEX_URL}
|
67 |
|
68 |
+
# Install remaining dependencies from the requirements file
|
69 |
+
# Use the -f flag to point pip to the PyG wheel index page
|
70 |
+
# CUDA_HOME should be inherited by this pip process
|
71 |
echo "Installing remaining packages from ${UNIRIG_REQS_FILE} with PyG wheel index..."
|
72 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir -r "${UNIRIG_REQS_FILE}" -f ${PYG_WHEEL_INDEX}
|
73 |
|
|
|
78 |
rm /tmp/${BLENDER_TARBALL}
|
79 |
echo "Cleanup complete."
|
80 |
|
81 |
+
echo "Blender setup finished successfully."
|