# ValueError: numpy.dtype has the wrong size, try recompiling

ValueError: numpy.dtype has the wrong size, try recompiling

Generally, produces always keep backward compatible binary interface ABI. But it to be known that it is not forward compatible:

Suppose a package is used in the numpy version in a compiled extension.The future version will also be compatible with these packages and it does not need to be recompiled again.Thus the packages will always be available though the Pandas version is updated.

But there is an error. Suppose a package is compiled for the version 1.7. But it may not work with with the numpy version of 1.6 that is the older versions.For most of the time the packages will not work.

But in some cases for example matplotlib compile the extensions with the older versions of numpy.In this case the packages will work with the older versions.

The mentioned error is the result of incompatibility of the packages.This can be resolved by updating the numpy versions or to recompile the packages and statsmodels against the older version of numpy installed.

Sometimes ABI backward compitability is broken.It happened with the numpy version of 1.4.0. The result was the packages that were compiled against the older version had incompatibility to previous versions.Thus the packages have to be recompiled again.

For python 2.7 and MAC OS try the following code:

easy_install --upgrade numpy

After installing update the packages using **pip**:

pip install pandas

Try the below code for best solution:

pip install --upgrade numpy pip install --upgrade scipy pip install --upgrade pandas

One can also use a single line coder:

pip install --upgrade numpy scipy pandas