2323import os
2424import subprocess
2525import sys
26- from pathlib import Path
2726
2827
2928def main ():
@@ -33,18 +32,14 @@ def main():
3332 This script looks for 'post_train_deps.txt' relative to its own location.
3433 It executes 'uv pip install -r <path_to_extra_deps.txt> --resolution=lowest'.
3534 """
36- script_dir = Path (__file__ ).resolve ().parent
37-
3835 os .environ ["VLLM_TARGET_DEVICE" ] = "tpu"
3936
40- # Adjust this path if your post_train_deps.txt is in a different location,
41- # e.g., script_dir / "data" / "post_train_deps.txt"
42- extra_deps_file = script_dir / "post_train_deps.txt"
37+ current_dir = os .path .dirname (os .path .abspath (__file__ ))
38+ repo_root = os .path .abspath (os .path .join (current_dir , ".." , ".." ))
39+ extra_deps_path = os .path .join (current_dir , "post_train_deps.txt" )
40+ if not os .path .exists (extra_deps_path ):
41+ raise FileNotFoundError (f"Dependencies file not found at { extra_deps_path } " )
4342
44- if not extra_deps_file .exists ():
45- print (f"Error: '{ extra_deps_file } ' not found." )
46- print ("Please ensure 'post_train_deps.txt' is in the correct location relative to the script." )
47- sys .exit (1 )
4843 # Check if 'uv' is available in the environment
4944 try :
5045 subprocess .run ([sys .executable , "-m" , "pip" , "install" , "uv" ], check = True , capture_output = True )
@@ -61,7 +56,7 @@ def main():
6156 "pip" ,
6257 "install" ,
6358 "-r" ,
64- str (extra_deps_file ),
59+ str (extra_deps_path ),
6560 "--no-deps" ,
6661 ]
6762
@@ -71,31 +66,20 @@ def main():
7166 "uv" ,
7267 "pip" ,
7368 "install" ,
74- "src /maxtext/integration/vllm" , # MaxText on vllm installations
69+ f" { repo_root } /maxtext/integration/vllm" , # MaxText on vllm installations
7570 "--no-deps" ,
7671 ]
7772
78- print (f"Installing extra dependencies from '{ extra_deps_file } ' using uv..." )
79- print (f"Running command: { ' ' .join (command )} " )
80-
8173 try :
8274 # Run the command to install Github dependencies
83- process = subprocess .run (command , check = True , capture_output = True , text = True )
75+ print (f"Installing extra dependencies: { ' ' .join (command )} " )
76+ _ = subprocess .run (command , check = True , capture_output = True , text = True )
8477 print ("Extra dependencies installed successfully!" )
85- print ("--- Output from uv ---" )
86- print (process .stdout )
87- if process .stderr :
88- print ("--- Errors/Warnings from uv (if any) ---" )
89- print (process .stderr )
9078
9179 # Run the command to install the MaxText vLLM directory
92- vllm_install_process = subprocess .run (local_vllm_install_command , check = True , capture_output = True , text = True )
80+ print (f"Installing MaxText vLLM dependency: { ' ' .join (local_vllm_install_command )} " )
81+ _ = subprocess .run (local_vllm_install_command , check = True , capture_output = True , text = True )
9382 print ("MaxText vLLM dependency installed successfully!" )
94- print ("--- Output from uv ---" )
95- print (vllm_install_process .stdout )
96- if vllm_install_process .stderr :
97- print ("--- Errors/Warnings from uv (if any) ---" )
98- print (vllm_install_process .stderr )
9983 except subprocess .CalledProcessError as e :
10084 print ("Failed to install extra dependencies." )
10185 print (f"Command '{ ' ' .join (e .cmd )} ' returned non-zero exit status { e .returncode } ." )
0 commit comments