nlopt-python icon indicating copy to clipboard operation
nlopt-python copied to clipboard

Numpy API compatibility breaks 2.7.1

Open jonas-eschle opened this issue 3 years ago • 5 comments

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

jonas-eschle avatar Mar 29 '22 22:03 jonas-eschle

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

codename5281 avatar Mar 31 '22 14:03 codename5281

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

jonas-eschle avatar Apr 01 '22 12:04 jonas-eschle

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.

DanielBok avatar Apr 02 '22 01:04 DanielBok

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!

jonas-eschle avatar Apr 02 '22 08:04 jonas-eschle

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

AntoineD avatar Jun 30 '22 12:06 AntoineD