From 77de3438638840f91fd0f604cdf58a96a19bdb2d Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Fri, 19 Jul 2024 13:18:07 +0300 Subject: [PATCH] Use "venv" module if virtualenv is not supported --- clearml_agent/helper/package/pip_api/venv.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/clearml_agent/helper/package/pip_api/venv.py b/clearml_agent/helper/package/pip_api/venv.py index 018dde4..965f83b 100644 --- a/clearml_agent/helper/package/pip_api/venv.py +++ b/clearml_agent/helper/package/pip_api/venv.py @@ -64,9 +64,18 @@ class VirtualenvPip(SystemPip, PackageManager): Only valid if instantiated with path. Use self.python as self.bin does not exist. """ - self.session.command( - self.python, "-m", "virtualenv", self.path, *self.create_flags() - ).check_call() + # noinspection PyBroadException + try: + self.session.command( + self.python, "-m", "virtualenv", self.path, *self.create_flags() + ).check_call() + except Exception as ex: + # let's try with std library instead + print("WARNING: virtualenv call failed: {}\n INFO: Creating virtual environment with venv".format(ex)) + self.session.command( + self.python, "-m", "venv", self.path, *self.create_flags() + ).check_call() + return self def remove(self):