Spaces:
Running
on
Zero
Running
on
Zero
Update setup_blender.sh
Browse files- setup_blender.sh +22 -2
setup_blender.sh
CHANGED
@@ -4,7 +4,7 @@ set -e
|
|
4 |
# --- Configuration ---
|
5 |
BLENDER_VERSION="4.2.0"
|
6 |
BLENDER_MAJOR_MINOR="4.2"
|
7 |
-
BLENDER_PYTHON_VERSION="python3.11"
|
8 |
BLENDER_TARBALL="blender-${BLENDER_VERSION}-linux-x64.tar.xz"
|
9 |
BLENDER_URL="https://download.blender.org/release/Blender${BLENDER_MAJOR_MINOR}/blender-${BLENDER_VERSION}-linux-x64.tar.xz"
|
10 |
INSTALL_DIR="/opt/blender-${BLENDER_VERSION}-linux-x64"
|
@@ -27,9 +27,27 @@ SPCONV_PACKAGE="spconv-${TARGET_CUDA_VERSION_SHORT}"
|
|
27 |
# --- Set Environment Variables for Build ---
|
28 |
export CUDA_HOME=${CUDA_HOME:-/usr/local/cuda}
|
29 |
export PATH="${CUDA_HOME}/bin:${PATH}"
|
30 |
-
export MAX_JOBS=4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
echo "Using CUDA_HOME=${CUDA_HOME}"
|
32 |
echo "Updated PATH: ${PATH}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
# --- Download and Extract Blender ---
|
35 |
echo "Downloading Blender ${BLENDER_VERSION}..."
|
@@ -74,12 +92,14 @@ echo "1. Installing PyTorch ${TORCH_VERSION} and Torchvision ${TORCHVISION_VERSI
|
|
74 |
--index-url ${TORCH_INDEX_URL}
|
75 |
|
76 |
echo "2. Installing dependencies from ${UNIRIG_REQS_FILE_IN_SPACE} (includes bpy, flash_attn)..."
|
|
|
77 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir -r "${UNIRIG_REQS_FILE_IN_SPACE}"
|
78 |
|
79 |
echo "3. Installing ${SPCONV_PACKAGE}..."
|
80 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir ${SPCONV_PACKAGE}
|
81 |
|
82 |
echo "4. Installing torch-scatter and torch-cluster..."
|
|
|
83 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
84 |
torch-scatter \
|
85 |
torch-cluster \
|
|
|
4 |
# --- Configuration ---
|
5 |
BLENDER_VERSION="4.2.0"
|
6 |
BLENDER_MAJOR_MINOR="4.2"
|
7 |
+
BLENDER_PYTHON_VERSION="python3.11" # Should match the -dev package (e.g., python3.11-dev)
|
8 |
BLENDER_TARBALL="blender-${BLENDER_VERSION}-linux-x64.tar.xz"
|
9 |
BLENDER_URL="https://download.blender.org/release/Blender${BLENDER_MAJOR_MINOR}/blender-${BLENDER_VERSION}-linux-x64.tar.xz"
|
10 |
INSTALL_DIR="/opt/blender-${BLENDER_VERSION}-linux-x64"
|
|
|
27 |
# --- Set Environment Variables for Build ---
|
28 |
export CUDA_HOME=${CUDA_HOME:-/usr/local/cuda}
|
29 |
export PATH="${CUDA_HOME}/bin:${PATH}"
|
30 |
+
export MAX_JOBS=4 # For compilation processes like flash-attn
|
31 |
+
# ** FIX: Explicitly add Python 3.11 include path for C/C++ header files **
|
32 |
+
# This assumes python3.11-dev is installed via packages.txt, providing headers here.
|
33 |
+
PYTHON_INCLUDE_DIR="/usr/include/python${BLENDER_PYTHON_VERSION#python}" # Extracts "3.11" from "python3.11"
|
34 |
+
export CPATH="${PYTHON_INCLUDE_DIR}:${CPATH}"
|
35 |
+
export C_INCLUDE_PATH="${PYTHON_INCLUDE_DIR}:${C_INCLUDE_PATH}"
|
36 |
+
export CPLUS_INCLUDE_PATH="${PYTHON_INCLUDE_DIR}:${CPLUS_INCLUDE_PATH}"
|
37 |
+
|
38 |
echo "Using CUDA_HOME=${CUDA_HOME}"
|
39 |
echo "Updated PATH: ${PATH}"
|
40 |
+
echo "CPATH set to: ${CPATH}"
|
41 |
+
echo "C_INCLUDE_PATH set to: ${C_INCLUDE_PATH}"
|
42 |
+
echo "CPLUS_INCLUDE_PATH set to: ${CPLUS_INCLUDE_PATH}"
|
43 |
+
echo "Expected Python include directory: ${PYTHON_INCLUDE_DIR}"
|
44 |
+
# Check if the Python.h file actually exists where we expect it
|
45 |
+
if [ -f "${PYTHON_INCLUDE_DIR}/Python.h" ]; then
|
46 |
+
echo "Found Python.h at ${PYTHON_INCLUDE_DIR}/Python.h"
|
47 |
+
else
|
48 |
+
echo "WARNING: Python.h NOT FOUND at ${PYTHON_INCLUDE_DIR}/Python.h. Ensure python${BLENDER_PYTHON_VERSION#python}-dev is in packages.txt and installed."
|
49 |
+
fi
|
50 |
+
|
51 |
|
52 |
# --- Download and Extract Blender ---
|
53 |
echo "Downloading Blender ${BLENDER_VERSION}..."
|
|
|
92 |
--index-url ${TORCH_INDEX_URL}
|
93 |
|
94 |
echo "2. Installing dependencies from ${UNIRIG_REQS_FILE_IN_SPACE} (includes bpy, flash_attn)..."
|
95 |
+
# flash-attn compilation might also benefit from CPATH
|
96 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir -r "${UNIRIG_REQS_FILE_IN_SPACE}"
|
97 |
|
98 |
echo "3. Installing ${SPCONV_PACKAGE}..."
|
99 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir ${SPCONV_PACKAGE}
|
100 |
|
101 |
echo "4. Installing torch-scatter and torch-cluster..."
|
102 |
+
# The CPATH, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH set above should help this step
|
103 |
"${BLENDER_PY_EXEC}" -m pip install --no-cache-dir \
|
104 |
torch-scatter \
|
105 |
torch-cluster \
|