1515from utils import ec2 as ec2_utils
1616
1717CPU_INSTANCE_COMMANDS_LIST = [
18- "python3 ts_scripts/install_dependencies.py --environment=dev" ,
19- "python3 torchserve_sanity.py" ,
18+ "python ts_scripts/install_dependencies.py --environment=dev" ,
19+ "python torchserve_sanity.py" ,
2020 "cd serving-sdk/ && mvn clean install -q && cd ../" ,
2121]
2222
2323GPU_INSTANCE_COMMANDS_LIST = [
24- "python3 ts_scripts/install_dependencies.py --environment=dev --cuda=cu102" ,
25- "python3 torchserve_sanity.py" ,
24+ "python ts_scripts/install_dependencies.py --environment=dev --cuda=cu102" ,
25+ "python torchserve_sanity.py" ,
2626 "cd serving-sdk/ && mvn clean install -q && cd ../" ,
2727]
2828
@@ -38,7 +38,7 @@ def run_commands_on_ec2_instance(ec2_connection, is_gpu):
3838 virtual_env_name = "venv"
3939
4040 with ec2_connection .cd (f"/home/ubuntu/serve" ):
41- ec2_connection .run (f"python3 -m venv { virtual_env_name } " )
41+ ec2_connection .run (f"python -m venv { virtual_env_name } " )
4242 with ec2_connection .prefix (f"source { virtual_env_name } /bin/activate" ):
4343 commands_list = GPU_INSTANCE_COMMANDS_LIST if is_gpu else CPU_INSTANCE_COMMANDS_LIST
4444
@@ -128,14 +128,13 @@ def launch_ec2_instance(region, instance_type, ami_id):
128128 else :
129129 ec2_connection .run (f"cd serve && git fetch origin { github_pull_request_number } " )
130130
131- ec2_connection .run (f"sudo apt-get install -y python3-venv" )
131+ ec2_connection .run (f"sudo apt-get install -y python3.8-dev python3.8-distutils python3.8-venv" )
132+ # update alternatives doesn't seem to work
133+ ec2_connection .run (f"sudo ln -fs /usr/bin/python3.8 /usr/bin/python" )
132134 # Following is necessary on Base Ubuntu DLAMI because the default python is python2
133135 # This will NOT fail for other AMI where default python is python3
134136 ec2_connection .run (
135- f"sudo cp /usr/local/bin/pip3 /usr/local/bin/pip && pip install --upgrade pip" , warn = True
136- )
137- ec2_connection .run (
138- f"sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1" , warn = True
137+ f"curl -O https://bootstrap.pypa.io/get-pip.py && python get-pip.py" , warn = True
139138 )
140139
141140 is_gpu = True if instance_type [:2 ] in GPU_INSTANCES else False
@@ -197,3 +196,4 @@ def main():
197196
198197if __name__ == "__main__" :
199198 main ()
199+
0 commit comments