@@ -772,10 +772,38 @@ def install_llama_cpp_make_non_blocking():
772772pass
773773
774774
775- def install_python_non_blocking (packages = []):
776- full_command = ["pip" , "install" ] + packages
777- run_installer = subprocess .Popen (full_command , stdout = subprocess .DEVNULL , stderr = subprocess .STDOUT )
778- return run_installer
775+ def install_python_non_blocking (packages = []):
776+ processes = []
777+
778+ if "protobuf" in packages :
779+ # First uninstall protobuf if it exists
780+ uninstall_cmd = ["pip" , "uninstall" , "-y" , "protobuf" ]
781+ processes .append (subprocess .Popen (uninstall_cmd , stdout = subprocess .DEVNULL , stderr = subprocess .STDOUT ))
782+
783+ # Install other packages (except protobuf) if any
784+ other_packages = [pkg for pkg in packages if pkg != "protobuf" ]
785+ if other_packages :
786+ install_cmd = ["pip" , "install" ] + other_packages
787+ processes .append (subprocess .Popen (install_cmd , stdout = subprocess .DEVNULL , stderr = subprocess .STDOUT ))
788+
789+ # Install protobuf with special handling
790+ protobuf_cmd = ["pip" , "install" , "--no-binary=protobuf" , "protobuf" ]
791+ processes .append (subprocess .Popen (protobuf_cmd , stdout = subprocess .DEVNULL , stderr = subprocess .STDOUT ))
792+ else :
793+ # Regular installation for other packages
794+ full_command = ["pip" , "install" ] + packages
795+ processes .append (subprocess .Popen (full_command , stdout = subprocess .DEVNULL , stderr = subprocess .STDOUT ))
796+
797+ # Return a wrapper object that can wait for all processes
798+ class ProcessWrapper :
799+ def __init__ (self , processes ):
800+ self .processes = processes
801+
802+ def wait (self ):
803+ for process in self .processes :
804+ process .wait ()
805+
806+ return ProcessWrapper (processes )
779807pass
780808
781809
0 commit comments