Fix Python 3.12+ compatibility issues

- Remove hardcoded PyTorch version constraints that prevent installation on Python 3.12+
- Update scikit-image from 0.21.0 to 0.22.0 to fix build failures with modern meson
- Simplify macOS environment script to use latest compatible PyTorch versions
- Allow pip to resolve PyTorch dependencies automatically for better compatibility

Fixes installation failures on newer Python versions where PyTorch 2.1.2 is not available.
Resolves scikit-image build errors due to outdated meson build system requirements.
pull/17132/head
ayush kandwal 2025-09-22 23:06:48 +05:30
parent 82a973c043
commit 9fd41cc3ac
3 changed files with 8 additions and 4 deletions

View File

@ -317,7 +317,11 @@ def requirements_met(requirements_file):
def prepare_environment():
torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu121")
torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.1.2 torchvision==0.16.2 --extra-index-url {torch_index_url}")
# Use more flexible PyTorch version handling to support newer Python versions
default_torch_command = f"pip install torch torchvision --extra-index-url {torch_index_url}"
torch_command = os.environ.get('TORCH_COMMAND', default_torch_command)
if args.use_ipex:
if platform.system() == "Windows":
# The "Nuullll/intel-extension-for-pytorch" wheels were built from IPEX source for Intel Arc GPU: https://github.com/intel/intel-extension-for-pytorch/tree/xpu-main

View File

@ -23,7 +23,7 @@ psutil==5.9.5
pytorch_lightning==1.9.4
resize-right==0.0.2
safetensors==0.4.2
scikit-image==0.21.0
scikit-image==0.22.0
spandrel==0.3.4
spandrel-extra-arches==0.1.1
tomesd==0.1.3

View File

@ -9,9 +9,9 @@ export COMMANDLINE_ARGS="--skip-torch-cuda-test --upcast-sampling --no-half-vae
export PYTORCH_ENABLE_MPS_FALLBACK=1
if [[ "$(sysctl -n machdep.cpu.brand_string)" =~ ^.*"Intel".*$ ]]; then
export TORCH_COMMAND="pip install torch==2.1.2 torchvision==0.16.2"
export TORCH_COMMAND="pip install torch torchvision"
else
export TORCH_COMMAND="pip install torch==2.3.1 torchvision==0.18.1"
export TORCH_COMMAND="pip install torch torchvision"
fi
####################################################################