Skip to content

Commit

Permalink
Merge pull request #1300 from akihironitta/bugfix/mamba-deadlock
Browse files Browse the repository at this point in the history
Bugfix: `mamba` used with an environment file never starts installation due to deadlock
  • Loading branch information
HaoZeke authored Jul 7, 2023
2 parents 5ab2d29 + 80eaf8d commit 06b06d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ API Changes

Bug Fixes
^^^^^^^^^
- Fixed the deadlock when mamba is used with an environment file. (#1300)

Other Changes and Additions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
16 changes: 6 additions & 10 deletions asv/plugins/mamba.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -107,13 +107,9 @@ 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,
)
solver = MambaSolver(
self._mamba_channels, None, self.context # or target_platform
self._run_mamba(
["env", "create", "-f", env_file_name, "-p", self._path, "--force"],
env=env,
)
with _mamba_lock():
transaction = solver.solve(mamba_pkgs + mamba_args)
Expand Down

0 comments on commit 06b06d8

Please sign in to comment.