facebook / Ax

Adaptive Experimentation Platform

Home Page:https://ax.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ax pulling numpy 2.0 with breaking changes

leandrobbraga opened this issue · comments

Hello, recently numpy released a new version , which is nice but unfortunately brings many breaking changes.

It seems that Ax is pulling this new version through dependencies which is breaking Ax's own code.

This is an example, but it's probably happening in all sort of places inside the library:

from ax.utils.common.logger import ROOT_LOGGER as AX_LOGGER
/usr/local/lib/python3.11/site-packages/ax/__init__.py:34: in <module>
    from ax.service import OptimizationLoop, optimize
/usr/local/lib/python3.11/site-packages/ax/service/__init__.py:7: in <module>
    from ax.service.managed_loop import OptimizationLoop, optimize
/usr/local/lib/python3.11/site-packages/ax/service/managed_loop.py:32: in <module>
    from ax.service.utils.best_point import (
/usr/local/lib/python3.11/site-packages/ax/service/utils/best_point.py:53: in <module>
    from numpy import NaN
E   ImportError: cannot import name 'NaN' from 'numpy' (/usr/local/lib/python3.11/site-packages/numpy/__init__.py)

As a temporary fix the user can limit numpy version to '<2.0.0', even if they do not depend directly on numpy.

@leandrobbraga thanks for reporting this! We're aware, and this should be fixed as of #2527 - please let us know if using a commit from after this change still gives you issues with numpy 2.0 compatibility.

@bernardbeckerman do you have an idea of when the next maintenance release of Ax will be? For now, I may just specify numpy<2.0 where appropriate.

I think we should be able to prioritize a release in the next couple of weeks! I'm out next week and a bit swamped this week, but I'll raise this with teammates to see if we can prioritize a release soon.