question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

numpy.ndarray binary incompatibility error in environments with `numpy<1.20`

See original GitHub issue

After upgrading sisl to 0.11.0 I can not import the package anymore.

The call: from sisl._indices import indices_le returns: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

OS Fedora 31 Python 3.7.6 numpy 1.17.5 (and others, see below)

Tried to reinstall numpy (same version) as suggested on the web, but couldn’t solve the problem. I am bound to this old numpy version due to other packages requirement, but I also tried in a new environment (same python version) numpy 1.18 and 1.19. Got the same error. Version of numpy 1.20, on the contrary, works.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:33 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
zerothicommented, Dec 2, 2021

Yes, you are correct, it is basically the same as you suggest.

The only doubt I have is: does oldest-supported-numpy consider that sisl only supports >=1.13 or can it try to use an even older version? Would it matter if it picked an older version? I.e., is the requirement for >=1.13 a build time requirement or just a requirement for usage (say because a specific method was introduced in 1.13)?

I think I just fixed this. sisl only has a build requirement for the oldest numpy version available for the current python version. And once runned it requires a specific version. I just committed f364af06be2aa1854d8205bcad24c84efc598db8 which removed my extraneous requirement in requires! That variable is only a build requirement.

0reactions
zerothicommented, Dec 3, 2021

I have now fixed it and tested some cases.

I am pretty sure (fingers crossed) that this is resolved for any later releases.

@pfebrer please have a look at the latest commit message and the file developments/test_numpy_installs.sh which tests a few things. You’ll note that this one will fail for v0.11.0 (due to not having proper build-dependencies) but will work regardless in the latest commits.

There were some things that needed updating, but I think this is on the right track.

Again, for future reference, one should be able to install sisl without problems if you pre-install the dependencies, and then subsequently install sisl with the --no-build-isolation to forcefully use the currently used versions:

python3 -m pip install -r requirements.txt
python3 -m pip install --no-build-isolation sisl-0.11.0.tar.gz

Note that if users manually install older numpy versions that do not follow the uploaded wheels for numpy, this procedure will fail and one really has to use the --no-build-isolation option.

I’ll close this, please re-open if not fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError: numpy.ndarray size changed, may indicate binary ...
I'm in Python 3.8.5. It sounds too simple to be real, but I had this same issue and all I did was reinstall...
Read more >
ValueError: numpy.ndarray size changed, may indicate binary ...
The "ValueError: numpy.ndarray size changed, may indicate binary incompatibility" occurs because there was a change in NumPy's C API in version ...
Read more >
FAQ — MMDetection3D 0.17.3 documentation
If you face the error shown below when importing pycocotools: ValueError: numpy.ndarray size changed, may indicate binary incompatibility.
Read more >
Release notes — NumPy v1.24 Manual
Deprecations · Deprecate fastCopyAndTranspose and PyArray_CopyAndTranspose · Compatibility notes · array. · New Features · New attribute symbol added to ...
Read more >
TensorFlow and Numpy Issue M1 | Apple Developer Forums
This error may indicate that you're trying to pass a Tensor to a NumPy call ... ValueError: numpy.ndarray size changed, may indicate binary...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found