FenTechSolutions / CausalDiscoveryToolbox

Package for causal inference in graphs and in the pairwise settings. Tools for graph structure recovery and dependencies are included.
https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/index.html
MIT License
1.08k stars 198 forks source link

Failed to import cdt on a machine without GPU. #40

Closed yishilin14 closed 4 years ago

yishilin14 commented 4 years ago

I am using Windows 7 and I don't have a GPU.

I create a fresh conda environment as follows.

conda create --prefix venv python=3.7
conda activate ./venv
# Note that I don't have a GPU. https://pytorch.org/get-started/locally/ 
conda install pytorch torchvision cpuonly -c pytorch
conda install pip
pip install cdt

Packages:

Executing import cdt failed. image

The following lines caused the problem. https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/6df55f4ec0800a377cb4688b7eaedb2b1f75f3fe/cdt/utils/Settings.py#L161-L163

My workaround is executing os.environ["CUDA_VISIBLE_DEVICES"]="[]" before executing import cdt.

diviyank commented 4 years ago

Thanks for the feedback ; this must be an incompatibility issue between GPUtils and Windows, I'll try to add another safeguard, to avoid workarounds :)

diviyank commented 4 years ago

It should be done; Please try to update your package and check if the error is still there !

yishilin14 commented 4 years ago

It works now! Thank you so much! Your package is awesome.