Skip to content

Commit a1decfa

Browse files
committed
install: fix cttc constraints
1 parent 0da986d commit a1decfa

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

‎scripts/install.sh‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,24 @@ run_prepare() {
261261
done
262262
}
263263

264-
run_install () {
264+
run_install () (
265265
detect_env
266+
if [[ "${FCM_CTTC}" == "True" && "${PACKAGE_MANAGER}" == "pip3" ]]; then
267+
# Keep subsequent model/package installs on the selected CTTC stack.
268+
# Apply NumPy/Pillow constraints before compiling native extensions too.
269+
CTTC_CONSTRAINTS="${SCRIPT_DIR}/install_utils/cttc-constraints.txt"
270+
export PIP_CONSTRAINT="${PIP_CONSTRAINT:+${PIP_CONSTRAINT} }${CTTC_CONSTRAINTS}"
271+
272+
# The bundled CompressAI metadata otherwise forces torchvision>=0.17
273+
# on Python 3.10, replacing the CTTC torch/torchvision pair.
274+
local compressai_patch="${SCRIPT_DIR}/install_utils/patches/0001-compressai-cttc-torchvision.patch"
275+
if git -C "${COMPRESSAI_VISION_ROOT_DIR}/compressai" apply --check "${compressai_patch}" >/dev/null 2>&1; then
276+
git -C "${COMPRESSAI_VISION_ROOT_DIR}/compressai" apply "${compressai_patch}"
277+
elif ! git -C "${COMPRESSAI_VISION_ROOT_DIR}/compressai" apply --reverse --check "${compressai_patch}" >/dev/null 2>&1; then
278+
echo "[ERROR] Could not apply CompressAI CTTC compatibility patch." >&2
279+
exit 1
280+
fi
281+
fi
266282
"${PIP[@]}" install -U pip wheel "setuptools>=68,<81"
267283

268284
echo "Selected Models to be installed: ${MODEL}"
@@ -311,7 +327,7 @@ run_install () {
311327
uv sync --inexact --extra="${BUILD_SUFFIX}" --dry-run
312328
uv sync --inexact --extra="${BUILD_SUFFIX}"
313329
fi
314-
}
330+
)
315331

316332
detect_cuda_version () {
317333
if [ -n "${CUDA_VERSION}" ]; then
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Shared by the vision installer and init_experiment's final FCTM install.
2+
torch==2.0.0; python_version < '3.12'
3+
torchvision==0.15.1; python_version < '3.12'
4+
torch==2.6.0; python_version >= '3.12'
5+
torchvision==0.21.0; python_version >= '3.12'
6+
numpy>=1.24.4,<2
7+
opencv-python>=4.8.0,<4.12.0
8+
pillow>=9.0,<10; python_version < '3.12'
9+
pillow>=10.1,<11; python_version >= '3.12'
10+
Cython==3.0.8
11+
setuptools>=68,<81
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/pyproject.toml b/pyproject.toml
2+
--- a/pyproject.toml
3+
+++ b/pyproject.toml
4+
@@ -47,7 +47,8 @@ dependencies = [
5+
"torch>=1.13.1",
6+
"torch>=2.6.0; python_version >= '3.12'",
7+
"torchvision>=0.14.1,<0.20; python_version < '3.9'",
8+
- "torchvision>=0.17.0; python_version >= '3.9'",
9+
+ "torchvision>=0.14.1; python_version >= '3.9' and python_version < '3.12'",
10+
+ "torchvision>=0.17.0; python_version >= '3.12'",
11+
"tqdm",
12+
"typing-extensions>=4.0.0",
13+
"wheel>=0.32.0", # For --no-build-isolation.

0 commit comments

Comments
 (0)