GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI changes · Issue #346 · PythonOT/POT

Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI changes #346

New issue
Copy link
New issue
Copy link
Closed
#349
Closed
Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI changes#346
#349
Copy link
Labels
bughelp wanted

Description

@davidghiurco
davidghiurco
opened on Feb 10, 2022
Issue body actions

Describe the bug

Currently the 0.8.1.0 release pyproject.toml has:

[build-system]
requires = ["setuptools", "wheel", "numpy>=1.20", "cython>=0.23"]
build-backend = "setuptools.build_meta"

The problem with numpy>=1.20 is that for source installations, as well as wheel builds, this will actually use the latest (at build time) version of numpy. This can have the unintended consequence of making the resulting POT build compatible only with that latest numpy version (and newer).

This is because builds against numpy are forward compatible, but not backward compatible. (Source: numpy docs). What this means for POT is that it should be compiled against the oldest numpy version that it supports. In our current case, this would be numpy==1.20.0, not whatever is the newest version at the time of compilation with numpy>=1.20 in pyproject.toml.

Addressing this problem will prevent future bug reports when POT is inevitably built against numpy>=1.22, which has a backwards-breaking ABI change to 1.20.x & 1.21.x (see https://numpy.org/doc/stable/release/1.22.0-notes.html#compatibility-notes, and numpy/numpy#19479)

There is a meta-package developed by numpy devs called oldest-supported-numpy which is meant to be used exclusively in pyproject.toml for the purposes of building/compiling against numpy. Newer versions of numpy can still be used as runtime dependencies without breaking binary compatibility.

To Reproduce

Steps to reproduce the behavior:
1.build current codebase from latest release 0.8.1.0 from source, it will be built against numpy>=1.22.x (which was released December 31st, 2021).
2. Attempt to use the compiled package on a platform running numpy==1.20.x or numpy==1.21.x, you will get something similar to: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

Expected behavior

POT should be built against the oldest numpy package it supports. This does not prevent using newer numpy versions as runtime dependencies.

Environment (please complete the following information):

  • OS (e.g. MacOS, Windows, Linux): MacOS Monterey, Version 12.1
  • Python version: 3.8+ (any python version that supports numpy 1.22.x is affected).
  • How was POT installed (source, pip, conda): pip & source, but this problem affects future wheel POT builds.
  • Build command you used (if compiling from source):

Activity

  1. davidghiurco
    added
    bug
    help wanted
    on Feb 10, 2022
  2. davidghiurco
    changed the title [-]Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI chan[/-] [+]Change pyproject.toml to require the oldest possible numpy version to prevent future backwards-breaking numpy ABI changes[/+] on Feb 10, 2022
  3. rflamary commented on Feb 11, 2022

    @rflamary
    rflamary
    on Feb 11, 2022
    Collaborator
    More actions

    Hello @davidghiurco and thank you for the detailed explanation.

    I'm OK with switching the pyproject.toml build dependency to oldest-supported-numpy instead of the current value since it will indeed provide since it will provide wheels that will work on most of the used version of numpy and it is the recommended strategy by numpy developers themselves.

    Could you do a PR with this change and add build all wheels in the test of your commit to trigger wheels building and check that nothing breaks?

  4. rflamary
    closed this as completedin #349on Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.