0

There is always a bug when I try to launch CAM in cdt. The code is here.

import networkx as nx
from cdt.causality.graph import CAM
from cdt.data import load_dataset
data, graph=load_dataset("sachs")
obj=CAM()

The error is File D:\anaconda\lib\site-packages\cdt\causality\graph\CAM.py:124 in init raise ImportError("R Package CAM is not available.")

ImportError: R Package CAM is not available.

Tried to install the CAM package in R and changed the rpath in Setting.py but no use.

monie
  • 1

1 Answers1

1

What I did was create a small script to download all the R requirements (the R language must already be downloaded therefore).

I believe a yaml file is still in the project folder (available here).

Nevertheless, here is what I did:

from rpy2.robjects.packages import importr, data

utils = importr('utils')
base = importr('base')

with open('r_requirements.txt') as f:
    text = f.readlines()

for pack in text:
    utils.install_packages(pack)