guillermo-navas-palencia / optbinning

Optimal binning: monotonic binning with constraints. Support batch & stream optimal binning. Scorecard modelling and counterfactual explanations.
http://gnpalencia.org/optbinning/
Apache License 2.0
435 stars 98 forks source link

'ortools' version conflict #267

Closed dslove closed 9 months ago

dslove commented 9 months ago

When running my program using optbinning I got a warning after upgrading from 0.15.0 to 0.18.0:

(CVXPY) Sep 27 02:10:16 PM: Encountered unexpected exception importing solver PDLP:
RuntimeError('Unrecognized new version of ortools (9.6.2534). Expected < 9.5.0.Please open a feature request on cvxpy to enable support for this version.')

I didn't open this issue to cvxpy in the first place because this happened after I upgraded optbinning and what confuses me is that cvxpy doesn't sound using ortools according to the dependency tree. I wonder if the problem might be in optbinning.

optbinning==0.18.0
├── matplotlib [required: Any, installed: 3.7.2]
│   ├── contourpy [required: >=1.0.1, installed: 1.1.0]
│   │   └── numpy [required: >=1.16, installed: 1.24.1]
│   ├── cycler [required: >=0.10, installed: 0.11.0]
│   ├── fonttools [required: >=4.22.0, installed: 4.42.1]
│   ├── kiwisolver [required: >=1.0.1, installed: 1.4.5]
│   ├── numpy [required: >=1.20, installed: 1.24.1]
│   ├── packaging [required: >=20.0, installed: 23.1]
│   ├── Pillow [required: >=6.2.0, installed: 10.0.0]
│   ├── pyparsing [required: >=2.3.1,<3.1, installed: 3.0.9]
│   └── python-dateutil [required: >=2.7, installed: 2.8.2]
│       └── six [required: >=1.5, installed: 1.16.0]
├── numpy [required: >=1.16.1, installed: 1.24.1]
├── ortools [required: >=9.4, installed: 9.6.2534]
│   ├── absl-py [required: >=0.13, installed: 1.4.0]
│   ├── numpy [required: >=1.13.3, installed: 1.24.1]
│   ├── protobuf [required: >=4.21.12, installed: 4.21.12]
│   └── scipy [required: >=1.10.0, installed: 1.11.2]
│       └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
├── pandas [required: Any, installed: 1.5.2]
│   ├── numpy [required: >=1.21.0, installed: 1.24.1]
│   ├── python-dateutil [required: >=2.8.1, installed: 2.8.2]
│   │   └── six [required: >=1.5, installed: 1.16.0]
│   └── pytz [required: >=2020.1, installed: 2023.3]
├── ropwr [required: >=1.0.0, installed: 1.0.0]
│   ├── cvxpy [required: >=1.1.14, installed: 1.3.2]
│   │   ├── ecos [required: >=2, installed: 2.0.12]
│   │   │   ├── numpy [required: >=1.6, installed: 1.24.1]
│   │   │   └── scipy [required: >=0.9, installed: 1.11.2]
│   │   │       └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
│   │   ├── numpy [required: >=1.15, installed: 1.24.1]
│   │   ├── osqp [required: >=0.4.1, installed: 0.6.1]
│   │   │   ├── future [required: Any, installed: 0.18.3]
│   │   │   ├── numpy [required: >=1.7, installed: 1.24.1]
│   │   │   └── scipy [required: >=0.13.2, installed: 1.11.2]
│   │   │       └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
│   │   ├── scipy [required: >=1.1.0, installed: 1.11.2]
│   │   │   └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
│   │   ├── scs [required: >=1.1.6, installed: 3.2.3]
│   │   │   ├── numpy [required: >=1.7, installed: 1.24.1]
│   │   │   └── scipy [required: >=0.13.2, installed: 1.11.2]
│   │   │       └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
│   │   └── setuptools [required: >65.5.1, installed: 68.1.2]
│   ├── numpy [required: >=1.16, installed: 1.24.1]
│   ├── scikit-learn [required: >=0.22, installed: 1.2.0]
│   │   ├── joblib [required: >=1.1.1, installed: 1.3.2]
│   │   ├── numpy [required: >=1.17.3, installed: 1.24.1]
│   │   ├── scipy [required: >=1.3.2, installed: 1.11.2]
│   │   │   └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
│   │   └── threadpoolctl [required: >=2.0.0, installed: 3.2.0]
│   └── scipy [required: >=1.6.1, installed: 1.11.2]
│       └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
├── scikit-learn [required: >=1.0.2, installed: 1.2.0]
│   ├── joblib [required: >=1.1.1, installed: 1.3.2]
│   ├── numpy [required: >=1.17.3, installed: 1.24.1]
│   ├── scipy [required: >=1.3.2, installed: 1.11.2]
│   │   └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
│   └── threadpoolctl [required: >=2.0.0, installed: 3.2.0]
└── scipy [required: >=1.6.0, installed: 1.11.2]
    └── numpy [required: >=1.21.6,<1.28.0, installed: 1.24.1]
vavrato commented 9 months ago

I solved this recently by just setting ortools to version < 9.5.0 manually

dslove commented 9 months ago

I solved this recently by just setting ortools to version < 9.5.0 manually

Thanks. Yes I know it can be fixed this way. This ticket is just to maybe find out the root cause.

guillermo-navas-palencia commented 9 months ago

I think CVXPY does not support the latest versions of ortools yet. However, CVXPY is only used for piecewise continuous binning, and the solver used is not ortools CP (only ECOS, HIGHS and OSQP). The cornerstone of optbinning is the ortools CP, so it will always require the latest version of ortools to use the most performant solver.

bmreiniger commented 9 months ago

See also this PR at cvxpy to fix the issue. I think it's not included in a release yet, but should fix things when it is. (I suppose it'd be worth checking by installing their main branch and rerunning a test script here?)

dslove commented 9 months ago

Seems cvxpy had a release 1.4.1 on last Thursday (10/12) which can be picked up now.

guillermo-navas-palencia commented 9 months ago

Thanks @dslove!