From 1f4da0448b8baee609607318b1f0c85cc71ef35d Mon Sep 17 00:00:00 2001 From: Akihiro Nitta Date: Thu, 6 Jul 2023 17:06:13 +0100 Subject: [PATCH 1/3] BUG: Fix mamba deadlock --- asv/plugins/mamba.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/asv/plugins/mamba.py b/asv/plugins/mamba.py index 2e012dc8c..452f6433c 100644 --- a/asv/plugins/mamba.py +++ b/asv/plugins/mamba.py @@ -107,11 +107,10 @@ def _setup(self): env_file_name = self._mamba_environment_file env_data = load(Path(env_file_name).open(), Loader=Loader) mamba_pkgs = [x for x in env_data.get("dependencies") if isinstance(x, str)] - with _mamba_lock(): - self._run_mamba( - ["env", "create", "-f", env_file_name, "-p", self._path, "--force"], - env=env, - ) + self._run_mamba( + ["env", "create", "-f", env_file_name, "-p", self._path, "--force"], + env=env, + ) solver = MambaSolver( self._mamba_channels, None, self.context # or target_platform ) From ee62b204d67eb7fa97c8766c03ac7e3f55624bd0 Mon Sep 17 00:00:00 2001 From: Akihiro Nitta Date: Thu, 6 Jul 2023 17:07:59 +0100 Subject: [PATCH 2/3] Refactor: Move out shared solver --- asv/plugins/mamba.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/asv/plugins/mamba.py b/asv/plugins/mamba.py index 452f6433c..4c2eb9319 100644 --- a/asv/plugins/mamba.py +++ b/asv/plugins/mamba.py @@ -87,13 +87,13 @@ def _setup(self): env = dict(os.environ) env.update(self.build_env_vars) Path(f"{self._path}/conda-meta").mkdir(parents=True, exist_ok=True) + solver = MambaSolver( + self._mamba_channels, None, self.context # or target_platform + ) if not self._mamba_environment_file: # Construct payload, env file sets python version mamba_pkgs = [f"python={self._python}", "wheel", "pip"] + mamba_args - solver = MambaSolver( - self._mamba_channels, None, self.context # or target_platform - ) with _mamba_lock(): transaction = solver.solve(mamba_pkgs) @@ -111,9 +111,6 @@ def _setup(self): ["env", "create", "-f", env_file_name, "-p", self._path, "--force"], env=env, ) - solver = MambaSolver( - self._mamba_channels, None, self.context # or target_platform - ) with _mamba_lock(): transaction = solver.solve(mamba_pkgs + mamba_args) transaction.execute(libmambapy.PrefixData(self._path)) From 80eaf8d0af882e7ac6f8ded9d0ff34ec1747cbc6 Mon Sep 17 00:00:00 2001 From: Akihiro Nitta Date: Thu, 6 Jul 2023 17:23:24 +0100 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 7f96d445e..386a6202e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,7 @@ API Changes Bug Fixes ^^^^^^^^^ +- Fixed the deadlock when mamba is used with an environment file. (#1300) Other Changes and Additions ^^^^^^^^^^^^^^^^^^^^^^^^^^^