asrhou / NATMI

NATMI: Network Analysis Toolkit for the Multicellular Interactions
MIT License
15 stars 11 forks source link

AttributeError: module 'pygraphviz' has no attribute 'AGraph' #27

Closed charlesgwellem closed 3 years ago

charlesgwellem commented 3 years ago

Thanks a lot for this great package. When I run the command below I get the attribute error :

AttributeError: module 'pygraphviz' has no attribute 'AGraph'

(base) charles@rahul-SYS-7039A-I:/media/charles/INTENSO/Charles/single_cell_rna_seq/nintedanibNATMI/NATMI$ python VisInteractions.py --sourceFolder em --interDB lrc2p --weightType mean --detectionThreshold 0.2 --plotFormat pdf --drawNetwork y --plotWidth 12 --plotHeight 10 --layout kk --fontSize 8 --edgeWidth 0 --maxClusterSize 0 --clusterDistance 1
===================================================
Input data:
The source dataset folder: em
The ligand-receptor interaction database: lrc2p
The weight type of cell-to-cell signaling: mean
The detection threshold for interactions to draw is: 0.2
The specicificity threshold for interactions to draw is: 0
The expression threshold for interactions to draw is: 0
The network layout: kk
The font size for cluster labels: 8
The edge width: 0.0
The maximum radius of the clusters: 0
The relative distance between clusters: 1.0
The plot width: 12
The plot height: 10
The plot format: pdf
===================================================
#### start to construct the cell-to-cell communication network
#### 20366 edges are loaded
#### plotting the weighted directed cell-to-cell communication network
#### the folder "/media/charles/INTENSO/Charles/single_cell_rna_seq/nintedanibNATMI/NATMI/em/Network_exp_0_spe_0_det_0.2_top_0_signal_lrc2p_weight_mean" has been created to save the analysis results
Traceback (most recent call last):
  File "VisInteractions.py", line 2507, in <module>
    MainNetwork(opt.sourceFolder, interDB, weightType, specificityThreshold, weightThreshold, detectionThreshold, keepTopEdge, layout, plotFormat,plotWidth, plotHeight, fontSize, edgeWidth, maxClusterSize, clusterDistance)
  File "VisInteractions.py", line 1327, in MainNetwork
    BuildInterClusterNetwork(origlabels, labels, cltSizes, ccolorList, edgeDF, specificityThreshold, weightThreshold, frequencyThreshold, keepTopEdge, interDB, weightType, layout, plotFormat, plotWidth, plotHeight, fontSize, edgeWidth, maxClusterSize, clusterDistance, resultDir)
  File "VisInteractions.py", line 1126, in BuildInterClusterNetwork
    readmeStr = DrawGraphvizPlot(readmeStr, 'edge-count', 'int', nxgC, adjCountM, dataType, resultDir, plotWidth, plotHeight, fontSize, edgeWidth, colorDict, cltSizeDict, maxClusterSize, wposDictCount, labels, specificityThreshold,weightThreshold,frequencyThreshold,interDB,weightType,layout,plotFormat)
  File "VisInteractions.py", line 883, in DrawGraphvizPlot
    nxgS = nx.nx_agraph.to_agraph(nxgS)
  File "/home/charles/anaconda3/lib/python3.8/site-packages/networkx/drawing/nx_agraph.py", line 139, in to_agraph
    A = pygraphviz.AGraph(name=N.name, strict=strict, directed=directed)
AttributeError: module 'pygraphviz' has no attribute 'AGraph'

How do I solve this please? My sstem is running on Python 3.8.3.

Thanks in advance for your help.

asrhou commented 3 years ago

Hi there,

Could you tell me the version of PyGraphviz installed on your computer? If you want to install PyGraphviz from Anaconda, please use "conda install -c alubbock pygraphviz" or "conda install -c conda-forge pygraphviz=1.5" to get PyGraphviz 1.5.

Best, Rui

charlesgwellem commented 3 years ago

Thank you very much. With "conda install -c alubbock pygraphviz", it now works.