Comments (13)
Can you try upgrading your Cython?
This looks like aio-libs/aiohttp#6600, which someone reports was fixed in Cython 0.29.5
from pandas.
potentially caused by this:
numpy/numpy@b3f9fc0
from pandas.
same issue
from pandas.
We are not planning on adding numpy 2 support to pandas 1.2.5 since numpy 2 compat is a pretty involved process and pandas 1.2.5 is already 3 years old at this point.
Please upgrade to pandas 2.2.2 as that is the first pandas version to support numpy 2.
from pandas.
Hi @lithomas1, I think there's a misunderstanding (I'll take numpy 2.0 mention from the title)
I'm not trying to use numpy 2.
The issue is rather that pandas 1.2.5 build no longer works (with numpy 1.26, see notes in the "installation logs" section).
I was just pointing out that a change done for numpy 2 seems to have bled into numpy 1.26 as a breaking change, potentially affecting projects that depend on numpy 1.26
Thanks for looking into this
from pandas.
Sorry for the misunderstanding.
Did you mention that this started failing after numpy 2.0 was released?
(If so, this might because the build of pandas 2.0 is pulling the newest numpy, not the one you have installed)
from pandas.
No worries! (and thanks again for your time, @lithomas1 )
Correct.
We noticed the pandas build started failing yesterday "out of the blue".
We've got dependencies versions pinned in our requirements file. We didn't make any changes to these versions. Here's a couple of them:
numpy==1.26.4
pandas==1.2.5
Investigating a bit we noticed that the NumPy project did a release release this week (2.0) and we found this change which seems to align with the error message we're getting in the pandas build (i.e. a missing struct attribute elsize
):
pandas/_libs/src/ujson/python/JSONtoObj.c:260:33: error: no member named 'elsize' in 'struct _PyArray_Descr'
npyarr->elsize = dtype->elsize;
~~~~~ ^
The easiest way a colleague found to repro this is as follows:
# make virtual env (make sure python is 3.11)
python -m venv ./sample-venv
# activate virtual env
. ./sample-venv/bin/activate
# install same packages we do in the project (relevant to pandas/numpy)
pip install --no-cache six==1.16.0
pip install --no-cache pytz==2024.1
pip install --no-cache python-dateutil==2.9.0.post0
pip install --no-cache numpy==1.26.4
pip install --no-cache cython==0.29.21
# blows up
pip install --no-cache pandas==1.2.5
from pandas.
Can you try installing pandas with --no-build-isolation
?
(You'll need all dependencies pre-installed, but this should force pip to use your numpy, and not pull its own numpy)
from pandas.
For what it's worth, this problem seems to be due to this line in pyproject.toml and can be fixed by changing it to "numpy<2; python_version>='3.9'"
from pandas.
Yeah, this is maybe something to consider in the future, but for now the --no-build-isolation
step should fix it.
from pandas.
Can you try installing pandas with --no-build-isolation
NEWEST EDIT:
Workaround:
We were able to get it working by using "--no-build-isolation" + bumping a cython version to 0.29.37. So:
# make virtual env (make sure python is 3.11)
python -m venv ./sample-venv
# activate virtual env
. ./sample-venv/bin/activate
# install same packages we do in the project (relevant to pandas/numpy)
pip install --no-cache six==1.16.0
pip install --no-cache pytz==2024.1
pip install --no-cache python-dateutil==2.9.0.post0
pip install --no-cache numpy==1.26.4
pip install --no-cache cython==0.29.37 <--------------- IMPORTANT: version
pip install --no-cache pandas==1.2.5 --no-build-isolation <------- IMPORTANT: no-build-isolation flag
# WORKS NOW!
OLD:
I tried pip install pandas==1.2.5 --no-build-isolation
and got a different error:
(EDIT: fwiw I got Python 3.11 when I got the the error below, someone reported that it worked while they were using Python 3.9)
pandas/_libs/algos.c:235:12: fatal error: 'longintrepr.h' file not found
#include "longintrepr.h"
^~~~~~~~~~~~~~~
from pandas.
Thanks for your help @lithomas1 (and @mttr ) ! 🙏
from pandas.
Related Issues (20)
- BUG: sort_values with ascending=False is not doing stable sorting
- QST: This library always worked, except with this specific .sav file, anyone could give me a clue on why?
- Potential performance regression with "BUG: Fix issue with negative labels in `group_cumsum` (#58984)"
- BUG: can't support numpy2.2,how to deal with it HOT 7
- BUG: df.all(skipna=False) HOT 2
- BUG: Parameter converters when using the read function. HOT 2
- BUG: read_parquet wrongly returns empty index if asked to read empty column list HOT 2
- ENH/BUG: pd.date_range() still defaults to nanosecond resolution HOT 1
- ENH: New Name for "numpy_nullable" dtype_backend HOT 5
- BUG: `DatetimeIndex.union` gives wrong result with "datetime64[us]"
- ENH: .isin() method should use __contains__ rather than __iter__ for user-defined classes to determine presence. HOT 6
- BUG: `pd.read_excel` gives uninformative error for protected files HOT 2
- BUG: eval fails to process expression when one column name starts with a digit or some special characters HOT 1
- BUG: pandas dataframe column definition or mapping does not cater for upper case values. HOT 1
- BUG: HOT 2
- BUG: Limit param of fillna method does not work for pd.Int64Dtype() HOT 2
- BUG: Failed to import pandas <2.1.0 witn numpy >=2.0.0 HOT 4
- BUG: `Series.clip` does not work with scalar numpy arrays. HOT 4
- BUG: `DataFrame.to_numpy()` unnecessarily upcasts to `object` dtype. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandas.