|
2 | 2 | import os |
3 | 3 | import re |
4 | 4 | import shutil |
5 | | -import sys |
6 | 5 | import tempfile |
7 | 6 | import uuid |
8 | 7 | from pathlib import Path |
@@ -65,25 +64,6 @@ def _validate_pyenv_is_available(): |
65 | 64 | ) |
66 | 65 |
|
67 | 66 |
|
68 | | -def _is_virtualenv_available(): |
69 | | - """ |
70 | | - Returns True if virtualenv is available, otherwise False. |
71 | | - """ |
72 | | - return shutil.which("virtualenv") is not None |
73 | | - |
74 | | - |
75 | | -def _validate_virtualenv_is_available(): |
76 | | - """ |
77 | | - Validates virtualenv is available. If not, throws an `MlflowException` with a brief instruction |
78 | | - on how to install virtualenv. |
79 | | - """ |
80 | | - if not _is_virtualenv_available(): |
81 | | - raise MlflowException( |
82 | | - "Could not find the virtualenv binary. Run `pip install virtualenv` to install " |
83 | | - "virtualenv." |
84 | | - ) |
85 | | - |
86 | | - |
87 | 67 | _SEMANTIC_VERSION_REGEX = re.compile(r"^([0-9]+)\.([0-9]+)\.([0-9]+)$") |
88 | 68 |
|
89 | 69 |
|
@@ -270,14 +250,7 @@ def _create_virtualenv( |
270 | 250 | python_env.python, pyenv_root=python_install_dir, capture_output=capture_output |
271 | 251 | ) |
272 | 252 | _logger.info(f"Creating a new environment in {env_dir} with {python_bin_path}") |
273 | | - env_creation_cmd = [ |
274 | | - sys.executable, |
275 | | - "-m", |
276 | | - "virtualenv", |
277 | | - "--python", |
278 | | - python_bin_path, |
279 | | - env_dir, |
280 | | - ] |
| 253 | + env_creation_cmd = [python_bin_path, "-m", "venv", env_dir] |
281 | 254 | install_deps_cmd_prefix = "python -m pip install" |
282 | 255 | elif env_manager == em.UV: |
283 | 256 | _logger.info( |
@@ -418,7 +391,6 @@ def _get_or_create_virtualenv( |
418 | 391 | """ |
419 | 392 | if env_manager == em.VIRTUALENV: |
420 | 393 | _validate_pyenv_is_available() |
421 | | - _validate_virtualenv_is_available() |
422 | 394 |
|
423 | 395 | local_model_path = Path(local_model_path) |
424 | 396 | python_env = _get_python_env(local_model_path) |
|
0 commit comments