GithubHelp home page GithubHelp logo

Comments (13)

lithomas1 avatar lithomas1 commented on July 30, 2024 1

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.

adrianonobre avatar adrianonobre commented on July 30, 2024

potentially caused by this:
numpy/numpy@b3f9fc0

from pandas.

myriky avatar myriky commented on July 30, 2024

same issue

from pandas.

lithomas1 avatar lithomas1 commented on July 30, 2024

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.

adrianonobre avatar adrianonobre commented on July 30, 2024

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.

lithomas1 avatar lithomas1 commented on July 30, 2024

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.

adrianonobre avatar adrianonobre commented on July 30, 2024

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.

lithomas1 avatar lithomas1 commented on July 30, 2024

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.

mttr avatar mttr commented on July 30, 2024

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.

lithomas1 avatar lithomas1 commented on July 30, 2024

Yeah, this is maybe something to consider in the future, but for now the --no-build-isolation step should fix it.

from pandas.

adrianonobre avatar adrianonobre commented on July 30, 2024

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.

adrianonobre avatar adrianonobre commented on July 30, 2024

Thanks for your help @lithomas1 (and @mttr ) ! 🙏

from pandas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.