Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

In jupyter notebook I am running through this error. I am using py I just installed pytorch, previously it was working fine.

import pyodbc
import pandas as pd
import matplotlib.pyplot as plt

import warnings
warnings.filterwarnings('ignore')

When I run the above cell I got the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-1051f624fd0e> in <module>()
      1 import pyodbc
----> 2 import pandas as pd
      3 import matplotlib.pyplot as plt
      4 
      5 import warnings

C:\Anaconda3\lib\site-packages\pandas\__init__.py in <module>()
     29 
     30 try:
---> 31     from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
     32 except ImportError as e:  # pragma: no cover
     33     # hack but overkill to use re

C:\Anaconda3\lib\site-packages\pandas\_libs\__init__.py in <module>()
      1 # flake8: noqa
      2 
----> 3 from .tslibs import (
      4     NaT,
      5     NaTType,

C:\Anaconda3\lib\site-packages\pandas\_libs\tslibs\__init__.py in <module>()
      1 # flake8: noqa
      2 
----> 3 from .conversion import localize_pydatetime, normalize_date
      4 from .nattype import NaT, NaTType, iNaT, is_null_datetimelike
      5 from .np_datetime import OutOfBoundsDatetime

__init__.pxd in init pandas._libs.tslibs.conversion()

ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
like image 356
Carlos Mougan Avatar asked Feb 20 '20 15:02

Carlos Mougan


1 Answers

Which version of numpy do you have installed? I got the same error with 1.18.5, downgrading to 1.16.0 or 1.16.1 solved the issue. Also check which numpy version is required by pytorch, and any other library requiring numpy, I found pipdeptree quite useful for that.

like image 138
Stefano Messina Avatar answered Sep 23 '22 17:09

Stefano Messina