DanielBok / nlopt-python

A project to package the NLOpt library to wheels
Other
29 stars 14 forks source link

Numpy API compatibility breaks 2.7.1 #12

Open jonas-eschle opened 2 years ago

jonas-eschle commented 2 years ago

With 2.7.1, there is an error when importing nlopt having a numpy version<1.22 installed.

Steps to reproduce: install numpy<1.22, install nlopt

I think this is related to https://github.com/pypa/pip/issues/9542

Error message:

RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jonas/anaconda3/envs/tmp38/lib/python3.8/site-packages/nlopt/__init__.py", line 1, in <module>
    from .nlopt import *
  File "/home/jonas/anaconda3/envs/tmp38/lib/python3.8/site-packages/nlopt/nlopt.py", line 20, in <module>
    from . import _nlopt
ImportError: numpy.core.multiarray failed to import
codename5281 commented 2 years ago

Hello, exact same issue here, commenting to follow up potential developments.

jonas-eschle commented 2 years ago

Hi @DanielBok, any news on this? It's quite an urgent issue because it is screwing up the installation of our package and therefore let's any CI that installs our package fail, anyone who uses our package basically.

This should not happen for patch releases I believe, so I hope for a fast resolvement, otherwise we can release a fix that is constraining the version to 2.7.0. Let us know

DanielBok commented 2 years ago

Hello @jonas-eschle, I think it would be better if you pinned it to 2.7.0. Based on what I read on the changelog, there shouldn't be any significant diff between 2 versions. I only plan to patch this project to support later releases of Python going forward.

jonas-eschle commented 2 years ago

Hi @DanielBok, thanks a lot for your response! I see, that is quite unfortunate and maybe comes from a misunderstanding. The version numbering usually depicts major.minor.patch, where "patch" should not change compatibility. So if a fix is needed in any version (major.minor) it can be done by increasing the patch version.

So is this really supposed to be a breaking change in a patch version? I understand that you may wanna drop older version (we gladly want that as soon as we can too), it's however quite unconventional. Was there a specific problem that occured with older numpy versions in order to break in a patch version? Maybe something we can help with?

Many thanks for making nlopt accessible in Python btw, I quite enjoy the library!

AntoineD commented 2 years ago

We are facing the same issue, could you please prevent your package from installing numpy<1.22?