Skip to content

Try to support numpy version 2 #969

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

BlueDrink9
Copy link

@BlueDrink9 BlueDrink9 commented May 8, 2025

This is well and truly in draft mode, and may never get off the ground without some serious decision making. As such, I'm not really expecting this to have this merged, but perhaps the work that I have done here might be helpful for someone else down the line.

Numpy 2 does not support python 3.8, which straightaway rules out some of the optional dependencies that EconML has (eg pytorch). To get it building and testing, I have just removed them, and so it would probably require some more work if it was desirable to keep those.

I'm not experienced with cython, and a lot of the cython code here was not particularly clear to me from the sparse comments, so most of what I've done is really on a best guess effort to get it to successfully compile and pass tests. I'm still working on getting the remaining warnings fixed, but it would definitely benefit from help from someone who actually understands cython/the numpy API .
That being said, some of the tests are failing with segfaults so clearly I have made some mistakes somewhere. I have highlighted where I think these most likely are, but it will need someone who actually understands cython/the numpy API to assess and fix.

@BlueDrink9
Copy link
Author

BlueDrink9 commented May 8, 2025

I'm a bit confused by the lkg.txt files, how do we regenerate those?

@BlueDrink9
Copy link
Author

git ls-files --eol shows that crlf in this repo is incredibly inconsistent. I would highly recommend, at some point, doing dos2unix or similar on every file, to avoid issues around line endings in the future!

@BlueDrink9 BlueDrink9 force-pushed the np2 branch 3 times, most recently from 82651c4 to 1894bdd Compare May 8, 2025 23:11
@BlueDrink9
Copy link
Author

A bunch of the continuous integration steps will need to be updated to use a later version of python rather than 3.8 as part of this

@BlueDrink9
Copy link
Author

Passing tests with a lot of warnings https://github.com/BlueDrink9/EconML/actions/runs/14917865406/job/41907412454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant