Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'DiGraph' object has no attribute 'node' #165

Open
theRealSuperMario opened this issue Jul 22, 2020 · 15 comments
Open

'DiGraph' object has no attribute 'node' #165

theRealSuperMario opened this issue Jul 22, 2020 · 15 comments

Comments

@theRealSuperMario
Copy link

theRealSuperMario commented Jul 22, 2020

Hi,

I love the idea of this project, however, it does not work for me. See output below.

Is there anything I can do to help fix this?

WARNING: Token 'CLASSDEF' defined, but not used
WARNING: Token 'END_UNEXPECTED' defined, but not used
WARNING: There are 2 unused tokens
Generating LALR tables
/Users/sandrobraun/.local/lib/python3.7/site-packages/ply-3.11-py3.7.egg/ply/lex.py:760: FutureWarning: Possible nested set at position 65
c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags)
/Users/sandrobraun/.local/lib/python3.7/site-packages/ply-3.11-py3.7.egg/ply/lex.py:498: FutureWarning: Possible nested set at position 118
lexre = re.compile(regex, reflags)
str
Traceback (most recent call last):
File "/Users/sandrobraun/miniconda3/envs/multnano/lib/python3.7/site-packages/smop/main.py", line 66, in main
G = resolve.resolve(stmt_list)
File "/Users/sandrobraun/miniconda3/envs/multnano/lib/python3.7/site-packages/smop/resolve.py", line 54, in resolve
u = G.node[n]["ident"]
AttributeError: 'DiGraph' object has no attribute 'node'
Errors: 1


pip freeze
attrs==19.3.0
certifi==2020.6.20
decorator==4.4.2
importlib-metadata==1.7.0
iniconfig==1.0.0
more-itertools==8.4.0
networkx==2.4
numpy==1.19.1
packaging==20.4
pluggy==0.13.1
ply==3.11
py==1.9.0
pyparsing==3.0.0a2
pytest==6.0.0rc1
scipy==1.5.1
six==1.15.0
smop==0.41
toml==0.10.1
zipp==3.1.0

Python 3.7.7

@Dozi7
Copy link

Dozi7 commented Jul 29, 2020

pip install networkx==1.11

@RobBW
Copy link

RobBW commented Jul 29, 2020 via email

@alexpazolinid
Copy link

I am having a similar problem...
c:\users\alexandre\anaconda3\lib\site-packages\ply\lex.py:760: FutureWarning: Possible nested set at position 65
c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags)
c:\users\alexandre\anaconda3\lib\site-packages\ply\lex.py:498: FutureWarning: Possible nested set at position 118
lexre = re.compile(regex, reflags)
str
Traceback (most recent call last):
File "c:\users\alexandre\anaconda3\lib\site-packages\smop\main.py", line 66, in main
G = resolve.resolve(stmt_list)
File "c:\users\alexandre\anaconda3\lib\site-packages\smop\resolve.py", line 54, in resolve
u = G.node[n]["ident"]
AttributeError: 'DiGraph' object has no attribute 'node'
Errors: 1

@IsabellLehmann
Copy link

@alexpazolinid @theRealSuperMario did you try pip install networkx==1.11 as mentioned by @RobBW ? For me this worked. If it worked for you too, please close the issue. :)

@DQuanR2
Copy link

DQuanR2 commented Nov 26, 2020

It also got fixed for me with the "pip install networkx==1.11"

@ipesanz
Copy link

ipesanz commented Jan 26, 2021

It worked for me in Windows 10, Python3.8 with network install
After that.... the output is a long list of str and a file generated :)

@TheShy321
Copy link

pip install networkx==1.11

thank you, For me this worked, it solve my problem

@clobob
Copy link

clobob commented Oct 22, 2021

pip install networkx==1.11
it not worked for me. New error appears after change to networkx 1.11.
File "D:\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "D:\Python\Python39\Scripts\smop.exe\__main__.py", line 4, in <module> File "D:\Python\Python39\lib\site-packages\smop\main.py", line 17, in <module> from . import resolve File "D:\Python\Python39\lib\site-packages\smop\resolve.py", line 22, in <module> import networkx as nx File "D:\Python\Python39\lib\site-packages\networkx\__init__.py", line 84, in <module> import networkx.generators File "D:\Python\Python39\lib\site-packages\networkx\generators\__init__.py", line 5, in <module> from networkx.generators.classic import * File "D:\Python\Python39\lib\site-packages\networkx\generators\classic.py", line 21, in <module> from networkx.algorithms.bipartite.generators import complete_bipartite_graph File "D:\Python\Python39\lib\site-packages\networkx\algorithms\__init__.py", line 12, in <module> from networkx.algorithms.dag import * File "D:\Python\Python39\lib\site-packages\networkx\algorithms\dag.py", line 2, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (D:\Python\Python39\lib\fractions.py)

Python 3.9.7

@DeeMW
Copy link

DeeMW commented Nov 4, 2021

pip install networkx==1.11 it not worked for me. New error appears after change to networkx 1.11. File "D:\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "D:\Python\Python39\Scripts\smop.exe\__main__.py", line 4, in <module> File "D:\Python\Python39\lib\site-packages\smop\main.py", line 17, in <module> from . import resolve File "D:\Python\Python39\lib\site-packages\smop\resolve.py", line 22, in <module> import networkx as nx File "D:\Python\Python39\lib\site-packages\networkx\__init__.py", line 84, in <module> import networkx.generators File "D:\Python\Python39\lib\site-packages\networkx\generators\__init__.py", line 5, in <module> from networkx.generators.classic import * File "D:\Python\Python39\lib\site-packages\networkx\generators\classic.py", line 21, in <module> from networkx.algorithms.bipartite.generators import complete_bipartite_graph File "D:\Python\Python39\lib\site-packages\networkx\algorithms\__init__.py", line 12, in <module> from networkx.algorithms.dag import * File "D:\Python\Python39\lib\site-packages\networkx\algorithms\dag.py", line 2, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (D:\Python\Python39\lib\fractions.py)

Python 3.9.7

I would suggest just go to that source file (D:\Python\Python39\lib\site-packages\networkx\algorithms\dag.py), remove the import statement, and replace the gcd occurrences with math.gcd

@DeeMW
Copy link

DeeMW commented Nov 4, 2021

the fractions.py is actually using math.gcd itself.

@sarimmehdi
Copy link

Why doesn't this work with the latest networkx? (2.6.2)

@GBR-613
Copy link

GBR-613 commented Nov 21, 2021

Not sure what happens, but 'DiGraph' object has no attribute 'node' in networkx==1.11 as well:

(nx) c:\Users\GBR-6\nx\Scripts>pip install networkx==1.11
Collecting networkx==1.11
  Downloading networkx-1.11-py2.py3-none-any.whl (1.3 MB)
     |████████████████████████████████| 1.3 MB 731 kB/s
Collecting decorator>=3.4.0
  Using cached decorator-5.1.0-py3-none-any.whl (9.1 kB)
Installing collected packages: decorator, networkx
Successfully installed decorator-5.1.0 networkx-1.11

(nx) c:\Users\GBR-6\nx\Scripts>python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx as nx
>>> nx
<module 'networkx' from 'c:\\Users\\GBR-6\\nx\\lib\\site-packages\\networkx\\__init__.py'>
>>> nx.DiGraph
<class 'networkx.classes.digraph.DiGraph'>
>>> nx.DiGraph.node
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'DiGraph' has no attribute 'node'
>>> nx.DiGraph.nodes
<function Graph.nodes at 0x0000021694471318>
>>>

I am going to submit a PR.

@GBR-613
Copy link

GBR-613 commented Nov 21, 2021

@victorlei PR submitted: #177 Please have a look.

@seb5433
Copy link

seb5433 commented Nov 11, 2022

I'm having the same issue with python 3.8 and networkx==1.11 has solved the problem.

@Parikshit-Vyas
Copy link

pip install networkx==1.11 it not worked for me. New error appears after change to networkx 1.11. File "D:\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "D:\Python\Python39\Scripts\smop.exe\__main__.py", line 4, in <module> File "D:\Python\Python39\lib\site-packages\smop\main.py", line 17, in <module> from . import resolve File "D:\Python\Python39\lib\site-packages\smop\resolve.py", line 22, in <module> import networkx as nx File "D:\Python\Python39\lib\site-packages\networkx\__init__.py", line 84, in <module> import networkx.generators File "D:\Python\Python39\lib\site-packages\networkx\generators\__init__.py", line 5, in <module> from networkx.generators.classic import * File "D:\Python\Python39\lib\site-packages\networkx\generators\classic.py", line 21, in <module> from networkx.algorithms.bipartite.generators import complete_bipartite_graph File "D:\Python\Python39\lib\site-packages\networkx\algorithms\__init__.py", line 12, in <module> from networkx.algorithms.dag import * File "D:\Python\Python39\lib\site-packages\networkx\algorithms\dag.py", line 2, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (D:\Python\Python39\lib\fractions.py)
Python 3.9.7

I would suggest just go to that source file (D:\Python\Python39\lib\site-packages\networkx\algorithms\dag.py), remove the import statement, and replace the gcd occurrences with math.gcd

Thanks a lot ! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests