Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI, installs failing caused by numpy API change #148

Merged
merged 7 commits into from Sep 9, 2021
Merged

Conversation

blake-riley
Copy link
Contributor

Pull Request Checklist

  • Will your PR merge into the dev branch?
    Exceptions will be made for urgent bugfixes.
  • Have you forked from dev?
    If not, please rebase your PR onto the most recent dev tip.
  • Does your PR title succinctly describe the changes?
    Explain to a new user by completing the sentence: 'This PR will: ...'
  • Fill out the template below.

Description of the Change

qFit seems to compile and install fine.
On some systems though (python >= 3.7), we might get a RuntimeError on any attempt to run a qFit program:
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd.

This is caused by different build and install requirements.

There is a consistent API version between numpy>=1.17,<1.20 (API 0xd).
This PR limits the numpy versions to this range in both the build (pyproject.toml) and install requirements (setup.py).

Release Notes

  • Fixed frequent RuntimeError by requiring numpy version 1.17 <= numpy < 1.20.

Without this option, pip will go fetch all the install_requires listed
in setup.py for an isolated build. The problem is that the version of
numpy it grabs could be different to one that is _already_ present in
the conda env.

Since numpy _is_ already present in the conda env, we expose it to pip
using the --no-build-isolation flag. This way, our C extension is built
against the same numpy as will be present in the conda env.

This is particularly important given numpy 1.20 has recently shifted
API version (see numpy/numpy/core/include/numpy/numpyconfig.h,
numpy/numpy/core/code_generators/cversions.txt).
First, note that the requirements for the build environment (e.g. for extensions)
  is different to the requirements for running the package (i.e. install_requires).
Build requirements are listed in pyproject.toml, install requirements in setup.py.

We don't need --no-build-isolation if we specify the same numpy requirements
  in both.
As such, I have reverted the previous commit.

There is a consistent numpy C-API between numpy 1.17 (technically 1.16.1)
  and 1.20 (see previous commit).
This commit consistently limits the numpy versions to that range.
… process"

Cleanup after debug.

This reverts commit a7ee1fe.
Cleanup before merge.

This reverts commit 321fd05.
@blake-riley blake-riley merged commit d4d7a9e into dev Sep 9, 2021
@blake-riley blake-riley deleted the hotfix/fixCI branch September 9, 2021 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant