File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -627,8 +627,24 @@ def prepare_environment():
627627 'add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'
628628 )
629629
630+ # Ensure build dependencies are installed before any package that might need them
631+ def ensure_build_dependencies ():
632+ """Ensure essential build tools are available"""
633+ if not is_installed ("wheel" ):
634+ run_pip ("install wheel" , "wheel" )
635+ # Check setuptools version compatibility
636+ try :
637+ setuptools_version = run (f'"{ python } " -c "import setuptools; print(setuptools.__version__)"' , None , None ).strip ()
638+ if setuptools_version >= "70" :
639+ run_pip ("install 'setuptools<70'" , "setuptools" )
640+ except Exception :
641+ # If setuptools check fails, install compatible version
642+ run_pip ("install 'setuptools<70'" , "setuptools" )
643+ # Install build dependencies early
644+ ensure_build_dependencies ()
645+
630646 if not is_installed ("clip" ):
631- run_pip (f"install { clip_package } " , "clip" )
647+ run_pip (f"install --no-build-isolation { clip_package } " , "clip" )
632648 startup_timer .record ("install clip" )
633649
634650 if not is_installed ("open_clip" ):
You can’t perform that action at this time.
0 commit comments