BiomedSciAI / causallib

A Python package for modular causal inference analysis and model evaluations
Apache License 2.0
728 stars 97 forks source link

Installation for Python version 3.11 #61

Closed nik-maheshwari closed 1 year ago

nik-maheshwari commented 1 year ago

Hi. I am trying to install this library in a Python 3.11 environment. I get the following error -

ERROR: Could not find a version that satisfies the requirement causallib (from versions: none)
ERROR: No matching distribution found for causallib

However, it works for Python 3.9. Are there plans to update the library to be available for Python 3.11?

Thanks.

ehudkr commented 1 year ago

Hi, thanks for bringing this to my attention. This is indeed strange. I mean, I do test up to Python 3.9 and the PyPI signifier says Python::3.9, but this in and of itself shouldn't block the ability to install causallib on higher Python version. I also don't seem to be able to replicate this. When I run

conda create -n test_causallib_install_with_py311 python=3.11
conda activate test_causallib_install_with_py311
pip install causallib

I get Successfully installed causallib-0.9.5.

Could you please provide more details so I can try to figure out from where this incompatibility arises?

nik-maheshwari commented 1 year ago

Hi, thank you for testing it out. And good to know it is working for higher Python versions. I think the errors I am getting is part due to the firewall we have in place for installing some of the dependent packages (tried this in our existing env and a new env). I will sort this out with our IT.

Just something I noticed - causallib has pandas dependency (pandas<2,>=0.25.2). Is there any plan to utilise the newer version of pandas? As our Conda environment is using pandas 2.0.3

ehudkr commented 1 year ago

Yes, the <2 is a guard against non backward-compatible changes in the API when increasing a major version. From some spare-time fiddling, there doesn't seem to be anything blocking causallib from working with pandas>2, but I haven't formally tested it yet.

If that's the cause of your problems, there might be an annoying workaround in the meantime to manually install causallib's other dependencies (sklearn, matplotlib, etc.), and then install causallib while forcing pip not to install its dependencies: pip install --no-deps causallib (see pip documentation).

ehudkr commented 1 year ago

Pandas >2 is now officially supported, and tests pass on Python 3.11 https://github.com/BiomedSciAI/causallib/pull/65