py-why / dowhy

DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks.
https://www.pywhy.org/dowhy
MIT License
7.01k stars 922 forks source link

Support for networkx > 3.x #941

Closed Zethson closed 1 year ago

Zethson commented 1 year ago

Currently dowhy pins networkx to < 3.x

networkx = "^2.8.5" in pyproject.toml

networkx 3.1 is out and dowhy breaks environments/can't be installed in environments with networkx 3.1. I'd appreciate a quick fix and release.

Companion of https://github.com/py-why/dowhy/issues/936

In general, dowhy's dependency requirements are still rather strict.

n8sty commented 1 year ago

I believe this is currently limited by the dependency on autogluon-core and autogluon-tabular which pins networkx<3.0. See here https://github.com/autogluon/autogluon/blob/331908824b863771b0df607d32ea1d7f68eb63d3/core/src/autogluon/core/_setup_utils.py#L28.

lgautier commented 1 year ago

Shouldn't the dependency to autogluon be optional since the gcm subpackage is experimental? That seems to be the intent here: https://github.com/py-why/dowhy/pull/786

And if the dependency is optional this means that networkx can be allowed to be >= 3.

Zethson commented 1 year ago

Poetry still checks for compatibility I thought. Even for extra dependencies. This also seems to prevent https://github.com/py-why/dowhy/issues/936

n8sty commented 1 year ago

Poetry checks for compatibility given the version ranges it's being provided. So, if you try installing dowhy without the autogluon extra and not using a lock file it will install a 3.x version of networkx.

emrekiciman commented 1 year ago

@lgautier's #954 is addressing this but I think @amit-sharma has an open question in the conversation for @lgautier (much appreciated @lgautier !)

Zethson commented 1 year ago

@n8sty when creating the lock file poetry won't be able to resolve it though. Even if is an optional dependency.

amit-sharma commented 1 year ago

963 fixes this.