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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INFO: Please pin your numpy < 2 if installing pandas via pip #55519

Closed
lithomas1 opened this issue Oct 14, 2023 · 9 comments · Fixed by #58087
Closed

INFO: Please pin your numpy < 2 if installing pandas via pip #55519

lithomas1 opened this issue Oct 14, 2023 · 9 comments · Fixed by #58087
Labels
Community Community topics (meetings, etc.)
Milestone

Comments

@lithomas1
Copy link
Member

lithomas1 commented Oct 14, 2023

numpy 2.0 is the next major release of numpy (scheduled to come out sometime in December), and as such contains several breaking API changes.

Because of this, as of right now, there is NO released pandas version compatible with numpy 2.0.

We are currently aiming to be compatible with the release of pandas 2.2 (the next minor version) for pandas, however this is not guaranteed (we are still working through a couple of issues).

So, to avoid issues when installing pandas with pip, you should pin numpy < 2.

Note: This does not affect conda users, as conda has a special mechanism to retroactively pin numpy on older released pandas versions.

@lithomas1 lithomas1 added the Community Community topics (meetings, etc.) label Oct 14, 2023
@lithomas1 lithomas1 pinned this issue Oct 14, 2023
@lithomas1 lithomas1 mentioned this issue Oct 14, 2023
5 tasks
@lithomas1 lithomas1 added Closing Candidate May be closeable, needs more eyeballs and removed Closing Candidate May be closeable, needs more eyeballs labels Dec 22, 2023
@lithomas1
Copy link
Member Author

This shouldn't be necessary anymore.

The next release of pandas (pandas 2.2.0) will be compatible with numpy 2.
We are currently targeting January-ish for the release.
(unless major problems crop up, we will release before numpy 2.0)

@lithomas1 lithomas1 unpinned this issue Dec 22, 2023
@lithomas1
Copy link
Member Author

The next release of pandas (pandas 2.2.0) will be compatible with numpy 2. We are currently targeting January-ish for the release. (unless major problems crop up, we will release before numpy 2.0)

Ugh, it looks like the numpy 2.0 rc is delayed until February, so we won't be able to have numpy 2.0 compat until pandas 2.2.1.

@TomNicholas
Copy link

Looks like the numpy v2.0.0.b1 release candidate was made available 5 days ago, so compatibility didn't make it into pandas 2.2.1 (which came out 3 weeks ago). Does this mean that the aim is now that pandas 2.2.2 be the first one to be compatible with 2.2.2?

(P.S. Thanks for all your work!)

@lithomas1
Copy link
Member Author

We are basically ready for numpy 2.0's release (as in no code changes are required for us to be compatible).

However, since we use numpy's C API, we must compile against numpy 2.0rc1 or later to be compatible with numpy 2.0. This is because numpy 2.0rc1 is the first numpy pre-release to be ABI stable.

Since numpy 2.0's development timeline has shifted a bunch, I am currently planning on just releasing bug fix updates of pandas on the regular cadence, but I will do a special bug fix release of pandas 2.2.x when numpy 2.0rc1 does come out.

(so pandas 2.2.2 will not necessarily support numpy 2.0, but some pandas 2.2.x will)

@lithomas1
Copy link
Member Author

Just a quick update, we're targeting pandas 2.2.2 for numpy 2.0 compatibility.

Expect a release in the coming weeks (probably next week, sometimeish)

@rgommers
Copy link
Contributor

rgommers commented Apr 3, 2024

Expect a release in the coming weeks (probably next week, sometimeish)

It'd be really helpful to do this as soon as is possible/reasonable for you, because Pandas is a dependency of so many other packages. There's a very long chain/tail of package releases that need to be made for numpy 2.x compatibility, so I'm hoping the key packages in the PyData stack don't already take weeks to do their releases.

@lithomas1
Copy link
Member Author

pandas 2.2.2 is out!

@ecorreig
Copy link

ecorreig commented Aug 31, 2024

I'm running pandas 2.2.2 and I still get:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

The documentation says it should be compatible; maybe it's an issue with pip?

@lithomas1
Copy link
Member Author

Can you open a new issue?

There's a lot of potential factors at play here (e.g. this could be coming from another library as well).

huddlej added a commit to blab/popcast that referenced this issue Sep 3, 2024
For pandas versions before 2.2, pin numpy to version 1 [1]. This commit
should fix CI for Python 3.9.

[1] pandas-dev/pandas#55519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Community topics (meetings, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants