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.

RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject

See original GitHub issue

Description

When trying to import astropy.stats I get the above AttributeError. Making the code unusable. Downgrading numpy has not worked at all.

Expected behavior

astropy.stats to be imported.

Actual behavior

Crashed with the above error. Note that if I just import astropy.stats then I get a different error

Steps to Reproduce

# Put your Python code snippet here.
from astropy.stats import sigma_clipped_stats

Traceback (most recent call last):
  File "apply_correction.py", line 52, in <module>
    from astropy.stats import sigma_clipped_stats
  File "/home/trystan/.local/lib/python3.6/site-packages/astropy/stats/__init__.py", line 14, in <module>
    from . import funcs
  File "/home/trystan/.local/lib/python3.6/site-packages/astropy/stats/funcs.py", line 17, in <module>
    from . import _stats
  File "__init__.pxd", line 918, in init astropy.stats._stats
RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 13, in <module>
    import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
  File "/usr/lib/python3.6/imp.py", line 33, in <module>
    DeprecationWarning, stacklevel=2)
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

Original exception was:
Traceback (most recent call last):
  File "apply_correction.py", line 52, in <module>
    from astropy.stats import sigma_clipped_stats
  File "/home/trystan/.local/lib/python3.6/site-packages/astropy/stats/__init__.py", line 14, in <module>
    from . import funcs
  File "/home/trystan/.local/lib/python3.6/site-packages/astropy/stats/funcs.py", line 17, in <module>
    from . import _stats
  File "__init__.pxd", line 918, in init astropy.stats._stats
RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject

System Details

[GCC 8.4.0] Numpy 1.19.5 astropy 4.1 Scipy 1.5.4 Matplotlib 3.3.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
embraycommented, Jan 18, 2021

I get this sometimes; it’s a Python environment error when you’re using some extension modules that were compiled against a different version of Numpy than the one you’re using.

1reaction
taldcroftcommented, Jan 16, 2021

BTW, if you are wondering about that warning there is useful info at:

tl;dr it should be benign. I’ve seen this and occasionally had to ignore it in pytest.ini to get warning-free test runs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError: numpy.ufunc size changed, may indicate binary ...
ValueError : numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject ; pandas as ...
Read more >
numpy.ufunc size changed, may indicate binary ... - GitHub
numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject. #3655.
Read more >
Pandas : ValueError: numpy.ufunc size changed, may indicate ...
Pandas : ValueError: numpy. ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject ...
Read more >
valueerror: numpy.ufunc size changed, may ... - Code Grepper
valueerror: numpy.ufunc size changed, may indicate binary incompatibility. expected 216 from c header, got 192 from pyobject.
Read more >
Andrew Plested on Twitter: "Using Numpy? Getting this error ...
Expected 216 from C header, got 192 from PyObject Upgrading from Numpy ... numpy.ufunc size changed, may indicate binary incompatibility.
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