Skip to content

Commit 0d44656

Browse files
committed
Fix python version enforcement when no environment file
1 parent 3dc489f commit 0d44656

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

asv/plugins/conda.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ def _setup(self):
136136
conda_args = [util.replace_python_version(arg, self._python) for arg in conda_args]
137137

138138
if not self._conda_environment_file:
139-
conda_args = ['wheel', 'pip'] + conda_args
139+
# With a user-provided envronment, we assume it specifies a python version;
140+
# without an environment.yml file, we need to add the python version ourselves
141+
conda_args = [f'python={self._python}', 'wheel', 'pip'] + conda_args
140142

141143
# Create a temporary environment.yml file
142144
# and use that to generate the env for benchmarking.

asv/plugins/mamba.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def _setup(self):
138138
env.update(self.build_env_vars)
139139
Path(f"{self._path}/conda-meta").mkdir(parents=True, exist_ok=True)
140140
if not self._mamba_environment_file:
141-
# Construct payload
142-
mamba_pkgs = ["wheel", "pip"]
141+
# Construct payload; since there is no environment.yml file, we need to add the python version ourselves
142+
mamba_pkgs = [f"python={self._python}", "wheel", "pip"]
143143
else:
144144
# For named environments
145145
env_file_name = self._mamba_environment_file

0 commit comments

Comments
 (0)