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.12k stars 197 forks source link

[BUG] Importing cdt breaks matplotlib due to qt library error #93

Open el-hult opened 3 years ago

el-hult commented 3 years ago

Describe the bug importing cdt and matplotlib in the wrong order creates a Qt library inconsistency

the following code works:

import sys
import cdt 
import seaborn
import matplotlib.pyplot as plt

print("python",sys.version)
for mod in ['matplotlib','torch','cdt','seaborn']:
    m=sys.modules.get(mod,None)
    print(mod,m.__version__)

plt.plot([1],[1])

and it outputs

python 3.7.1 (default, Oct 28 2018, 08:39:03) [MSC v.1912 64 bit (AMD64)]
No GPU automatically detected. Setting SETTINGS.GPU to 0, and SETTINGS.NJOBS to cpu_count.
matplotlib 3.3.2
torch 1.4.0
cdt 0.5.23
seaborn 0.11.1

But if the cdt import comes after either the seaborn or the matplotlib imports, then I get the error

Cannot mix incompatible Qt library (version 0x50906) with this library (version 0x50907)

cdt is installed via PyPI, all other packages via conda

diviyank commented 3 years ago

This is strange, I'll look into it, maybe to remove the matplotlib/seaborn import; Thanks for the feedback