asv icon indicating copy to clipboard operation
asv copied to clipboard

asv does not recognize build-time dependencies in pyproject.toml

Open astrofrog opened this issue 6 years ago • 7 comments

Astropy has recently switched to specifying build-time dependencies in a pyproject.toml file, but this is causing issues with the asv benchmarks:

·· Uninstalling from conda-py3.7-Cython-jinja2-matplotlib3.1-nomkl-numpy1.17-scipy1.3
·· Building de9db8be <master> for conda-py3.7-Cython-jinja2-matplotlib3.1-nomkl-numpy1.17-scipy1.3
·· Error running /home/tom/Code/astropy-benchmarks/env/6381b426c3f1b97e7dd2ccd2288569b2/bin/python setup.py build (exit status 1)
   STDOUT -------->
   
   STDERR -------->
   Traceback (most recent call last):
     File "setup.py", line 11, in <module>
       from extension_helpers import get_extensions
   ModuleNotFoundError: No module named 'extension_helpers'

·· Failed to build the project and import the benchmark suite.

This is because it looks like asv uses python setup.py build. Is there a way to make asv install the package using pip instead of setup.py commands?

astrofrog avatar Feb 04 '20 14:02 astrofrog

See here: https://asv.readthedocs.io/en/stable/asv.conf.json.html#build-command-install-command-uninstall-command

pv avatar Feb 05 '20 00:02 pv

I have the same issue. If I set:

"build_command":
    ["PIP_NO_BUILD_ISOLATION=false python -m pip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"],

Then the build fails:

ModuleNotFoundError: No module named 'Cython'

If I change the build command to the following

"build_command":
    ["python -m pip wheel -w {build_cache_dir} {build_dir}"],

The benchmarks fail:

·· Installing 5879f97d <dev> into virtualenv-py3.8
·· Failed to build the project and import the benchmark suite.

Running in verbose mode shows that the package is built correctly, and there is no obvious error message. For brevity, I do not include the verbose output.

lrntct avatar Jul 16 '20 02:07 lrntct

@lrntct {build_cache_dir} isn't an actual directory. This seems to work fine to me, the question is answered. If you are sure it doesn't work, a reproducible example would be useful. Also, please use -v if you get build failures with pip, so you can see the actual build log - that will probably tell you what is going on.

rgommers avatar Aug 09 '20 19:08 rgommers

I'm strugging to get asv working with a project that requires setuptools_scm at build time. Setting

    "build_command": ["python -mpip install setuptools_scm",
                      "python setup.py build",
                      "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"],

didn't do the trick. Can anyone point to what needs to be changed to get this to work?

dstansby avatar Jul 22 '21 17:07 dstansby

Ah my bad, changing "python -mpip install setuptools_scm" to "python -mpip install extension_helpers" fixed it; hopefully my above comment is helpful for anyone coming across similar issues.

dstansby avatar Jul 22 '21 17:07 dstansby

I got ASV to work with flit by prefixing the default build command with pip install flit. In the end, it looked like this:

  "build_command": [
    "python -m pip install flit",
    "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"
  ],

saulshanabrook avatar Jul 18 '22 16:07 saulshanabrook

Should the default command perhaps instead use build?

    "build_command": [
        "python -m pip install build",
        "python -m build --wheel -o {build_cache_dir} {build_dir}",
    ],

This worked for me with a package using setuptools_scm

ZedThree avatar Oct 12 '22 12:10 ZedThree