Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject #1251

Open
NehaKoppikar opened this issue Jun 25, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@NehaKoppikar
Copy link

System Info

OS Version: 14.4.1
Python Version: 3.9.7
PandasAI version: 0.2.2

馃悰 Describe the bug

Used the following code:

import os
import pandas as pd
from pandasai.agent import Agent

Sample DataFrame

sales_by_country = pd.DataFrame({
"country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
"sales": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]
})

By default, unless you choose a different LLM, it will use BambooLLM.

##You can get your free API key signing up at https://pandabi.ai (you can also configure it in your .env file)
os.environ["PANDASAI_API_KEY"] = ""

agent = Agent(sales_by_country)
response = agent.chat('write insight about data')
print(response)

@dosubot dosubot bot added the bug Something isn't working label Jun 25, 2024
Copy link

dosubot bot commented Jun 25, 2024

To resolve the ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject error, you can try updating or reinstalling the numpy package. This error often occurs due to a mismatch between the versions of numpy and other packages that depend on it.

Here is how you can update numpy using pip:

pip install --upgrade numpy

If updating numpy does not resolve the issue, you can try reinstalling it:

pip uninstall numpy
pip install numpy

Additionally, ensure that all your packages are compatible with each other by updating them:

pip install --upgrade pandas pandasai

These steps should help resolve the binary incompatibility issue [1].

To continue talking to Dosu, mention @dosu.

@NehaKoppikar
Copy link
Author

NehaKoppikar commented Jun 25, 2024

This is not resolving the issue

@wjjc1017
Copy link

wjjc1017 commented Jun 28, 2024

This is because numpy has recently been upgraded to version 2.0.0, which is different from version 1.26.*. By default, pip install numpy==2.0.0 is used. The solution is simply to run
pip install numpy==1.26.4 pyyaml

@naaman
Copy link

naaman commented Jul 8, 2024

Came here to mention I also had to downgrade numpy. Hopefully 2.0 compatibility is coming. If it's not getting fixed, it's probably worth mentioning in the docs that it's not (yet?) compatible with numpy 2.0+ and you should specify the latest 1.x release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants