Installation
Installation of bnlearn
is straightforward.
It is advisable to create a new environment which is done as following:
conda create -n env_bnlearn python=3.8
conda activate env_bnlearn

Create environment.
Notice the last line. You need to see that your environment is now set as bnlearn
. In my case it is as following:
(env_bnlearn) D:\>
Deactivate and then activate your environment if the packages are not recognized.
conda deactivate
conda activate env_bnlearn
After creating the environment, install bnlearn
with pip:
# Install bnlearn and if a version is readily present on your local machine, this version will be installed.
pip install bnlearn
# Make sure to have the latest version from pypi by using the -U (update) argument.
pip install -U bnlearn

Install bnlearn.
Validate
Lets checkout whether it works by a simple example. Start python in your console:
python
Run the following lines which should result in a figure:
import bnlearn as bn
df = bn.import_example()
model = bn.structure_learning.fit(df)
G = bn.plot(model)

Uninstalling
If you want to remove your bnlearn
installation with your environment, it can be as following:
# List all the active environments. BNLEARN should be listed.
conda env list
# Remove the env_bnlearn environment
conda env remove --name env_bnlearn
# List all the active environments. env_bnlearn should be absent.
conda env list