|
228 | 228 | # We use python 3.10 to be consistent with the python version of the |
229 | 229 | # AWS's Deep Learning AMI's default conda environment. |
230 | 230 | CONDA_INSTALLATION_COMMANDS = ( |
231 | | - # Validate that conda *runs*, not just that the binary exists. A |
232 | | - # half-installed conda from a previous crashed setup run can leave a |
233 | | - # binary on the PVC with an unrelocated shebang (e.g. |
234 | | - # `#!/croot/conda_…/_h_env_placehold…/bin/python`) which `which` |
235 | | - # treats as present but every invocation fails with "command not |
236 | | - # found" because the shebang's python path doesn't exist. In that |
237 | | - # case we must reinstall — but the Miniconda installer refuses to |
238 | | - # overwrite an existing prefix, so we also wipe the broken dir first. |
239 | | - f'(command -v conda >/dev/null 2>&1 && conda --version >/dev/null 2>&1) || ' |
| 231 | + 'which conda > /dev/null 2>&1 || ' |
240 | 232 | '{ ' |
241 | | - f'echo "conda not functional; reinstalling miniconda at {SKY_CONDA_ROOT}"; ' |
242 | | - f'rm -rf "{SKY_CONDA_ROOT}"; ' |
243 | 233 | # Use uname -m to get the architecture of the machine and download the |
244 | 234 | # corresponding Miniconda3-Linux.sh script. |
245 | 235 | # Download to /tmp to ensure write access for non-root users. |
|
274 | 264 | # Install uv for venv management and pip installation. |
275 | 265 | f'{SKY_UV_INSTALL_CMD};' |
276 | 266 | # Create a separate python environment for SkyPilot dependencies. |
277 | | - # |
278 | | - # Validate that the venv *works*, not just that the directory exists. |
279 | | - # A previous crashed install can leave a directory with partial |
280 | | - # contents (no bin/python, or a broken bin/python whose interpreter |
281 | | - # files were truncated). `uv pip install --python <venv>/bin/python` |
282 | | - # downstream then fails with "No virtual environment or system Python |
283 | | - # installation found for path". Test the interpreter end-to-end and |
284 | | - # rebuild the venv if it doesn't run. |
285 | | - f'([ -x {SKY_REMOTE_PYTHON_ENV}/bin/python ] && ' |
286 | | - f'{SKY_REMOTE_PYTHON_ENV}/bin/python -c "import sys" >/dev/null 2>&1) || ' |
287 | | - f'{{ echo "skypilot-runtime venv not functional; recreating"; ' |
288 | | - f'rm -rf {SKY_REMOTE_PYTHON_ENV}; ' |
| 267 | + f'[ -d {SKY_REMOTE_PYTHON_ENV} ] || ' |
289 | 268 | # Do NOT use --system-site-packages here, because if users upgrade any |
290 | 269 | # packages in the base env, they interfere with skypilot dependencies. |
291 | 270 | # Reference: https://github.com/skypilot-org/skypilot/issues/4097 |
|
298 | 277 | # uv to use the python version specified in the `.python_version` file. |
299 | 278 | # TODO(zhwu): consider adding --python-preference only-managed to avoid |
300 | 279 | # using the system python, if a user report such issue. |
301 | | - f'{SKY_UV_CMD} venv --seed {SKY_REMOTE_PYTHON_ENV} --python 3.10; }};' |
| 280 | + f'{SKY_UV_CMD} venv --seed {SKY_REMOTE_PYTHON_ENV} --python 3.10;' |
302 | 281 | f'echo "$(echo {SKY_REMOTE_PYTHON_ENV})/bin/python" > {SKY_PYTHON_PATH_FILE};' # pylint: disable=line-too-long |
303 | 282 | ) |
304 | 283 |
|
|
0 commit comments