Closed JianxunSu closed 2 years ago
The training is okay, can't plot the causal graph
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
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
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.
Ok, Thanks for explanation!
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?
The pip installed graphviz
is just a python wrapper of os native graphviz.
The description from pypi:
@JianxunSu
@lixfz in my case, the pip install helped, so I should install the os package already.
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}.')