Skip to content

BUILD: ValueError raised when importing pandas due to numpy.ndarray size change #54178

@luke396

Description

@luke396

Installation check

Platform

Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.31

Installation Method

pip install

pandas Version

2.1.0.dev0+1210.gaa4922a96b

Python Version

3.10.12

Installation Logs

I followed the instructions provided at https://pandas.pydata.org/docs/dev/development/contributing_environment.html and successfully installed pandas using mamba with the command python -m pip install -ve . --no-build-isolation --config-settings editable-verbose=true.

However, when attempting to import pandas using either pytest pandas or import pandas, I encountered the following error: ValueError: numpy.ndarray size changed, which may indicate binary incompatibility. Expected 96 from C header, but got 88 from PyObject.

I found a related issue at #49683, where it was suggested to use pip install oldest-supported-numpy maybe resolve the problem. However, this command installs numpy-1.21.6 and did not work for me.

Fortunately, I received help from @Dr-Irv on Slack, who recommended using the following command: mamba install numpy=1.23.2 -c conda-forge. This solution worked for me.

I spent a significant amount of time attempting various approaches without success. As a result, I am documenting this solution to assist anyone who may encounter a similar problem in the future, thereby saving them time and effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions