Skip to content

Commit 9091549

Browse files
committed
Use mamba, if available, as the default to install packages instead of conda
1 parent 64594a6 commit 9091549

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

yggdrasil/drivers/ModelDriver.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ def install_dependency(cls, package=None, package_manager=None,
885885
if package_manager is None:
886886
if tools.get_conda_prefix():
887887
package_manager = 'conda'
888+
if shutil.which('mamba'):
889+
package_manager = 'mamba'
888890
elif platform._is_mac:
889891
package_manager = 'brew'
890892
elif platform._is_linux:
@@ -895,11 +897,11 @@ def install_dependency(cls, package=None, package_manager=None,
895897
cmd_kwargs = {}
896898
if command:
897899
cmd = copy.copy(command)
898-
elif package_manager == 'conda':
899-
cmd = ['conda', 'install'] + package
900+
elif package_manager in ('conda', 'mamba'):
901+
cmd = [package_manager, 'install'] + package
900902
if platform._is_win: # pragma: windows
901-
# Conda commands must be run on the shell on windows as it
902-
# is implemented as a batch script
903+
# Conda/mamba commands must be run on the shell on
904+
# windows as it is implemented as a batch script
903905
cmd.insert(0, 'call')
904906
cmd_kwargs['shell'] = True
905907
yes_cmd = ['-y']

0 commit comments

Comments
 (0)