BiomedSciAI / causallib

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

'module' object is not callable #42

Closed woonjeung closed 2 years ago

woonjeung commented 2 years ago

I try to apply several examples of causallib

============================= %matplotlib inline from causallib.evaluation import evaluate import matplotlib.pyplot as plt

evaluation_results = evaluate(ipw, X, a, y)

Whenever I import evaluate from causallib.evaluation, I always meet same error. How I can solve this problem.


TypeError Traceback (most recent call last) Input In [20], in <cell line: 5>() 2 from causallib.evaluation import evaluate 3 import matplotlib.pyplot as plt ----> 5 evaluation_results = evaluate(ipw, X, a, y) 6 fig, ax = plt.subplots(figsize=(6, 6)) 7 evaluation_results.plot_covariate_balance(kind="love", ax=ax)

TypeError: 'module' object is not callable

ehudkr commented 2 years ago

Hi, thank you so much for your interest in causallib and its evaluation suite. We've just recently merged a big API change to evaluation suite: https://github.com/IBM/causallib/pull/40. However, this change is still not reflected on PyPi since I haven't packaged and released a new version yet (I'm waiting for a couple more additions for 0.9.0). So currently there's a mismatch between the Notebooks version on github and the capabilities available in the latest version available from PyPi. Until a newer release is available, I can think of two possible solutions:

  1. Install the version existing in the main branch on github pip install https://github.com/IBM/causallib/archive/master.zip
  2. Use the Notebooks suited to the 0.8.* versions: https://github.com/IBM/causallib/tree/1932387e063cd012e084de85317b8b3ea5e2d319/examples

Let me know if that worked out for you.

woonjeung commented 2 years ago

Hi^^ Thank you for your help. I can overcome this problem using first solution. Have a nice day~!

fobembe commented 2 years ago

Hi ehudkr, thanks for this awesome package. I ran into a similar issue with woonjeung and I implemented the first solution. It worked for me yesterday, but today it is no longer working. Any help?

ehudkr commented 2 years ago

Thanks Femi, I'm sorry to hear. When you say it is "no longer working", do you mean that your local copy that you previously installed (yesterday) no longer works, or that trying to pull the same installation again today doesn't work for you? If that's the former, it sounds like a local machine problem, because once a version is installed locally it should stay the same. Are you sure there isn't any mix-ups with different virtual environments or something for that matter? Can you please try to do a new clean install (new virtual environment / conda environment)? If that's the latter, it is also strange, because the main branch haven't changed in the last since my previous answer, so it should still be as compatible. Maybe double check your pip arguments? Trying to force re-download from github using the --no-cache-dir flag? I guess pip might get slightly confused because the setup.py version in the Github is still not bumped (it is 0.8.2, as in pypi, but it is has different code in it. I usually only bump version before a new release, and not for every time the main branch is being updated)

ehudkr commented 2 years ago

Hi everyone, just letting you know I just released version 0.9.0 to PyPI, so things should now work when simply running pip install causallib (without the need to install the version from this github repo). https://pypi.org/project/causallib/0.9.0/

If this solves your problems I will close this issue later.

fobembe commented 2 years ago

Hello Ehud, It's a great pleasure having your response to my issue on the causallib package.  First of all, let me thank you most seriously for that great job of releasing the package.  It really solved a lot of problems for me as an Economist.  Of all the packages in the market addressing causality, yours is the most straightforward for me to follow especially with examples I can easily relate with.  I really enjoying it. As regards my issue, I have been working on google colab and each time I want to work, I have to re-install the package because my local Jupiter notebook is not stable.  So, while I was working the day before yesterday, it worked and I planned to use it on a bigger scale the following day to analyze some data I have, so I had to re-install it again, but unfortunately, that didn't work.   Since you've released a newer version, I think I should be fine. Thanks a lot again and have a pleasant day. Femi. On Thursday, September 29, 2022 at 07:33:58 AM CDT, Ehud Karavani @.***> wrote:

Hi everyone, just letting you know I just released version 0.9.0 to PyPI, so things should now work when simply running pip install causallib (without the need to install the version from this github repo). https://pypi.org/project/causallib/0.9.0/

If this solves your problems I will close this issue later.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

fobembe commented 2 years ago

Hello Ehud, I am still facing issues with the package. I have to use another PC where I have never installed the package to run my data, but unfortunately, I keep getting the same error.  I will really appreciate any help from your side.  The error is displayed as follows:ThanksFemi

On Thursday, September 29, 2022 at 01:45:45 AM CDT, Ehud Karavani ***@***.***> wrote:  

Thanks Femi, I'm sorry to hear. When you say it is "no longer working", do you mean that your local copy that you previously installed (yesterday) no longer works, or that trying to pull the same installation again today doesn't work for you? If that's the former, it sounds like a local machine problem, because once a version is installed locally it should stay the same. Are you sure there isn't any mix-ups with different virtual environments or something for that matter? Can you please try to do a new clean install (new virtual environment / conda environment)? If that's the latter, it is also strange, because the main branch haven't changed in the last since my previous answer, so it should still be as compatible. Maybe double check your pip arguments? Trying to force re-download from github using the --no-cache-dir flag? I guess pip might get slightly confused because the setup.py version in the Github is still not bumped (it is 0.8.2, as in pypi, but it is has different code in it. I usually only bump version before a new release, and not for every time the main branch is being updated)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

ehudkr commented 2 years ago

Hi Femi, sorry to hear your problem persists. First, please note that you did not share your error message, and please try again. Second, please also try to send a small code snippet that reproduces the problem. I tried to install causallib on a Colab Notebook and I did manage to do that successfully: image