airspeed-velocity/asv

BUG: `build` is not always present

anissa111 opened this issue · 7 comments

Hello!

Links:

Our ASV benchmarks started failing yesterday after the 0.6.2 release:

Couldn't load asv.plugins._mamba_helpers because
No module named 'libmambapy'

I've replicated this locally, where it fails with 0.6.2 but works when deprecated to 0.6.1

(asv-bench) ➜  benchmarks git:(main) ✗ asv --version
Couldn't load asv.plugins._mamba_helpers because
No module named 'libmambapy'
asv 0.6.2
(asv-bench) ➜  benchmarks git:(main) ✗ asv check    
Couldn't load asv.plugins._mamba_helpers because
No module named 'libmambapy'
· Discovering benchmarks
· Checking benchmarks
·· No problems found.
(asv-bench) ➜  benchmarks git:(main) ✗ pip install asv=="0.6.1"
Collecting asv==0.6.1
  Using cached asv-0.6.1-cp310-cp310-macosx_11_0_arm64.whl.metadata (3.5 kB)
Requirement already satisfied: asv-runner>=v0.1.0 in /Users/anissaz/miniconda3/envs/asv-bench/lib/python3.10/site-packages (from asv==0.6.1) (0.2.1)
Requirement already satisfied: json5 in /Users/anissaz/miniconda3/envs/asv-bench/lib/python3.10/site-packages (from asv==0.6.1) (0.9.14)
Requirement already satisfied: tabulate in /Users/anissaz/miniconda3/envs/asv-bench/lib/python3.10/site-packages (from asv==0.6.1) (0.9.0)
Requirement already satisfied: pyyaml in /Users/anissaz/miniconda3/envs/asv-bench/lib/python3.10/site-packages (from asv==0.6.1) (6.0.1)
Requirement already satisfied: pympler in /Users/anissaz/miniconda3/envs/asv-bench/lib/python3.10/site-packages (from asv==0.6.1) (1.0.1)
Requirement already satisfied: importlib-metadata in /Users/anissaz/miniconda3/envs/asv-bench/lib/python3.10/site-packages (from asv-runner>=v0.1.0->asv==0.6.1) (7.0.1)
Requirement already satisfied: zipp>=0.5 in /Users/anissaz/miniconda3/envs/asv-bench/lib/python3.10/site-packages (from importlib-metadata->asv-runner>=v0.1.0->asv==0.6.1) (3.17.0)
Using cached asv-0.6.1-cp310-cp310-macosx_11_0_arm64.whl (295 kB)
Installing collected packages: asv
  Attempting uninstall: asv
    Found existing installation: asv 0.6.2
    Uninstalling asv-0.6.2:
      Successfully uninstalled asv-0.6.2
Successfully installed asv-0.6.1
(asv-bench) ➜  benchmarks git:(main) ✗ asv check
· Discovering benchmarks
· Checking benchmarks
·· No problems found.

Thank you!

Looks like the import in _mamba_helpers needs to be made 'optional' in some way:

import libmambapy

... OR libmambapy needs to be added to ASV's core dependencies:

asv/pyproject.toml

Lines 29 to 38 in a779f0c

dependencies = [
"asv-runner>=v0.2.1",
"json5",
"tabulate",
"virtualenv",
"tomli",
"colorama; platform_system == 'Windows'",
"pyyaml; platform_python_implementation != \"PyPy\"",
"pympler; platform_python_implementation != \"PyPy\"",
]

... OR libmambapy needs to be added to ASV's core dependencies:

It doesn't look like libmambapy exists in PyPI (rather than conda).

mattip commented

@HaoZeke could you take a look?

As far as I recall this is just a logging note and not an error. Tests on CI pass completely without libmambapy. I'll take a look.

This is because of the change made to the default build command in the presence of pyproject.toml which is now:

        if cmd is None:
            if has_file('pyproject.toml'):
                cmd = [
                    "python -m build",
                    "python -mpip wheel -w {build_cache_dir} {build_dir}"
                ]
            else:
                cmd = [
                    "python setup.py build",
                    "python -mpip wheel -w {build_cache_dir} {build_dir}"
                ]

So the basic workaround for this case is to just depend on build.

The change is noted in the docs but not the changelog, and should be more prominently mentioned.