We Are Going To Discuss About **ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject**. So lets Start this Python Article.

## ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

**How to solve ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject**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 numpy. Gone.

`pip install --upgrade numpy`

or`pip uninstall numpy pip install numpy`

**ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject**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 numpy. Gone.

`pip install --upgrade numpy`

or`pip uninstall numpy pip install numpy`

## Solution 1

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 numpy. Gone.

```
pip install --upgrade numpy
```

or

```
pip uninstall numpy
pip install numpy
```

Original Author Andreu Of This Content

## Solution 2

try with `numpy==1.20.0`

this worked here, even though other circumstances are different (python3.8 on alpine 3.12).

Original Author mmacata Of This Content

## Solution 3

Indeed, (building and) installing with `numpy>=1.20.0`

should work, as pointed out e.g. by this answer below. However, I thought some background might be interesting — and provide also alternative solutions.

There was a change in the C API in `numpy 1.20.0`

. In some cases, `pip`

seems to download the latest version of `numpy`

for the build stage, but then the program is run with the installed version of `numpy`

. If the build version used in `<1.20`

, but the installed version is `=>1.20`

, this will lead to an error.

(The other way around it should not matter, because of backwards compatibility. But if one uses an installed version `numpy<1.20`

, they did not anticipate the upcoming change.)

This leads to several possible ways to solve the problem:

- upgrade (the build version) to
`numpy>=1.20.0`

- use
*minmum supported numpy*version in`pyproject.toml`

(`oldest-supported-numpy`

) - install with
`--no-binary`

- install with
`--no-build-isolation`

For a more detailed discussion of potential solutions, see

https://github.com/scikit-learn-contrib/hdbscan/issues/457#issuecomment-773671043.

Original Author FZeiser Of This Content

## Solution 4

## Solution without upgrading `numpy`

While upgrading the `numpy`

version would often solve the issue, it’s not always viable. Good example is the case when you’re using `tensorflow==2.6.0`

which isn’t compatible with the newest `numpy`

version (it requires `~=1.19.2`

).

As already mentioned in FZeiser’s answer, there was a change in `numpy`

s C API in version `1.20.0`

. There are packages that rely on this C API when they are being built, e.g. `pycocotools`

. Given that `pip`

s dependency resolver doesn’t guarantee any order for installing the packages, the following might happen:

`pip`

figures out that it needs to install`numpy`

and it chooses the latest version,`1.21.2`

as of the time writing this answer.- It then builds a package that depends on
`numpy`

and its C API, e.g.`pycocotools`

. This package is now compatible with`numpy 1.21.2`

C API. - At a later point
`pip`

needs to install a package that has a requirement for an older version of`numpy`

, e.g.`tensorflow==2.6.0`

which would try to install`numpy==1.19.5`

. As a result,`numpy==1.21.2`

is uninstalled and the older version is installed. - When running code that uses
`pycocotools`

, its current installation relies on the updated`numpy`

C API, yet the`numpy`

version was downgraded which would result in the error.

### Solution

You should rebuild the package with the outdated `numpy`

C API usage, e.g. for `pycocotools`

:

```
pip uninstall pycocotools
pip install pycocotools --no-binary pycocotools
```

Original Author Ivaylo Toskov Of This Content

## Conclusion

So This is all About **This Tutorial.** Hope This Tutorial Helped You. Thank You.