CausalDiscoveryToolbox icon indicating copy to clipboard operation
CausalDiscoveryToolbox copied to clipboard

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

Open el-hult opened this issue 4 years ago • 1 comments

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

el-hult avatar Feb 01 '21 11:02 el-hult

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

diviyank avatar Feb 02 '21 10:02 diviyank