diff --git a/clearml_agent/commands/worker.py b/clearml_agent/commands/worker.py index f1e98f4..aa8b0f4 100644 --- a/clearml_agent/commands/worker.py +++ b/clearml_agent/commands/worker.py @@ -3453,8 +3453,6 @@ class Worker(ServiceCommandSection): self.uv.initialize(cwd=lockfile_path) api = self.uv.get_api(lockfile_path) if api.enabled: - # TODO: what should this be? This controls where uv installs its venv - os.environ["UV_PROJECT_ENVIRONMENT"] = None print('UV Enabled: Ignoring requested python packages, using repository uv lock file!') api.install() return api diff --git a/clearml_agent/helper/package/uv_api.py b/clearml_agent/helper/package/uv_api.py index 295d018..55576a2 100644 --- a/clearml_agent/helper/package/uv_api.py +++ b/clearml_agent/helper/package/uv_api.py @@ -73,8 +73,12 @@ class UvConfig: kwargs["env"]["PATH"] = path if self.session and self.session.config and args and args[0] == "sync": + # Set the cache dir to venvs dir + if (cache_dir := self.session.config.get("agent.venvs_dir", None)) is not None: + os.environ["UV_CACHE_DIR"] = cache_dir + extra_args = self.session.config.get( - "agent.package_manager.uv_install_extra_args", None + "agent.package_manager.uv_sync_extra_args", None ) if extra_args: args = args + tuple(extra_args)