Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run case_study_bank.py plotting issue on Mac #27

Closed
JianxunSu opened this issue Jul 18, 2022 · 8 comments
Closed

run case_study_bank.py plotting issue on Mac #27

JianxunSu opened this issue Jul 18, 2022 · 8 comments
Assignees

Comments

@JianxunSu
Copy link

There is a issue happened when run case_study_bank.py on Mac Machine:
MacOS Monterey 12.3.1
Python 3.10
Errors as following:

why.plot_causal_graph()

...
07-17 17:18:23 I ylearn._why.py 508 - encode treatment ...
07-17 17:18:23 I ylearn._why.py 518 - preprocess data ...
07-17 17:18:24 I ylearn._why.py 536 - fit estimator for Card_Category with PermutedTLearner(model=GradientBoostingRegressor(max_depth=100), random_state=2022, kwargs=None)
/Users/jevin/dev/python/ai/YLearn/ylearn/utils/_common.py:95: UserWarning: Failed to display pydot image: [Errno 2] "fdp" not found in path..
warnings.warn(f'Failed to display pydot image: {e}.')

@JianxunSu
Copy link
Author

The training is okay, can't plot the causal graph

@JianxunSu JianxunSu changed the title run case_study_bank.py issue on Mac run case_study_bank.py plotting issue on Mac Jul 18, 2022
@lixfz
Copy link
Collaborator

lixfz commented Jul 18, 2022

graphviz is required to plot causal graph, see http://www.graphviz.org/download/ for more details.

If your python env was created with conda, you can also install graphviz with command :

conda install graphviz 

@JianxunSu
Copy link
Author

JianxunSu commented Jul 18, 2022

Yes, it works, Thanks! So should the graphviz be included in requirements.txt or is this just a library needed for MacOS? I uploaded this notebook to Google Colab run successfully, it needn't ask me to install graphviz, the only library manually installed is just ylearn. @lixfz

@lixfz
Copy link
Collaborator

lixfz commented Jul 18, 2022

The graphviz is an operating system dependent software, can not be installed through pip command.
Generally, it should be installed through the os's package manager.

Google Colab has installed the graphviz by default,so we can use it directly.

@JianxunSu
Copy link
Author

Ok, Thanks for explanation!

@JianxunSu
Copy link
Author

JianxunSu commented Jul 18, 2022

By the way, I did install graphviz on my MacOs with "pip install graphviz" and pycharm python package, like following:
(venv) jevin@JSU YLearn (main) $ pip install graphviz
Collecting graphviz
Using cached graphviz-0.20-py3-none-any.whl (46 kB)
Installing collected packages: graphviz
Successfully installed graphviz-0.20
@lixfz

If I remove this graphviz-0.20 python library, it will generate the original error again.

I think I have installed OS level graphviz already(before downloading YLearn), this python library installation only provide an interface, is that correct?

@lixfz
Copy link
Collaborator

lixfz commented Jul 19, 2022

The pip installed graphviz is just a python wrapper of os native graphviz.

The description from pypi:

image

@JianxunSu

@JianxunSu
Copy link
Author

@lixfz in my case, the pip install helped, so I should install the os package already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants