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

AttributeError: 'NoneType' object has no attribute 'nodes' #54

Open
jiay302 opened this issue Dec 21, 2017 · 23 comments
Open

AttributeError: 'NoneType' object has no attribute 'nodes' #54

jiay302 opened this issue Dec 21, 2017 · 23 comments

Comments

@jiay302
Copy link

jiay302 commented Dec 21, 2017

When I set --max-memory-data-size 0, it throws following errors:
Number of nodes: 6301
Number of walks: 63010
Data size (walks*length): 2520400
Data size 2520400 is larger than limit (max-memory-data-size: 0). Dumping walks to disk.
Walking...
Traceback (most recent call last):
File "D:\Python27\Scripts\deepwalk-script.py", line 11, in
load_entry_point('deepwalk==1.0.1', 'console_scripts', 'deepwalk')()
File "D:\Python27\lib\site-packages\deepwalk-1.0.1-py2.7.egg\deepwalk_main_.py", line 162, in main
process(args)
File "D:\Python27\lib\site-packages\deepwalk-1.0.1-py2.7.egg\deepwalk_main_.py", line 83, in process
num_workers=args.workers)
File "D:\Python27\lib\site-packages\deepwalk-1.0.1-py2.7.egg\deepwalk\walks.py", line 85, in write_walks_to_disk
for file_ in executor.map(_write_walks_to_disk, args_list):
File "D:\Python27\lib\site-packages\concurrent\futures_base.py", line 641, in result_iterator
yield fs.pop().result()
File "D:\Python27\lib\site-packages\concurrent\futures_base.py", line 462, in result
return self.__get_result()
File "D:\Python27\lib\site-packages\concurrent\futures_base.py", line 414, in __get_result
raise exception_type, self._exception, self._traceback
AttributeError: 'NoneType' object has no attribute 'nodes'
Is there someone can help me?

@GTmac
Copy link
Collaborator

GTmac commented Dec 21, 2017

Are you running DeepWalk on Windows? Seems it is the same issue as #18 and #53. Please try the solution in #53 and let me know if it works :)

@jiay302
Copy link
Author

jiay302 commented Dec 21, 2017

I am running DeepWalk on Windows. I have the same issue as yours, I now have no solutions.

@GTmac
Copy link
Collaborator

GTmac commented Dec 21, 2017

Please try either of the following two options:

  • Use Python 2 instead of Python 3
  • Upgrade your future package to the latest

@jiay302
Copy link
Author

jiay302 commented Dec 21, 2017

I am using Python 2, and future package is the latest.

@jiay302
Copy link
Author

jiay302 commented Dec 21, 2017

It doesn't throw errors when I run DeepWalk on Ubuntu. @GTmac

@GTmac
Copy link
Collaborator

GTmac commented Dec 21, 2017

I do not have a Windows machine at this moment. Can you check the version of packages which appear in https://github.com/phanein/deepwalk/blob/master/requirements.txt? Are they the same under Ubuntu and Windows on your machine?

@jiay302
Copy link
Author

jiay302 commented Dec 21, 2017

wheel and argparse are not the same, others are the same.

@jiay302
Copy link
Author

jiay302 commented Dec 21, 2017

I have changed the version of wheel and argparse packages and made their version be the same as Ubuntu's. But it still throws errors when running it on Windows. @GTmac

@MohsenFazaeli
Copy link

I traced the error and it seems that in line 64 and 65 of module walks
global __current_graph __current_graph = G
variable __current_graph is assigned as a global value but in line 53 in function _write_walks_to_disk of same module
g = __current_graph
__current_graph is none. IDK how to solve it but this causes the null object error.

@asdfhalkehflkajdhf
Copy link

我认为,这是一个BUG,出现这个错误是因为变量并不能在多进程中共享,而且在程序中我并没有看到使用multiprocessing对变量__current_graph 进行多进程共享设置。我查看了python对多进程和多线程的支持,在老版本中两者的区分是混乱的。我使用的环境中最新的anacoda3 python3.6。

修改使用线程ThreadPoolExecutor,或是multiprocessing 设置进程共享变量,并没有出现任何错误。

当然对于python的多线程和多进程的效率我表示同情。@GTmac

@GTmac
Copy link
Collaborator

GTmac commented May 4, 2018

@asdfhalkehflkajdhf Nice insights! I will update the repo later to switch to multithreading.

@usernamezcn
Copy link

I am running DeepWalk on Windows. I have the same issue as yours, I now have no solutions.

I met your problem too. Have you solved it?

@usernamezcn
Copy link

I met your problem too, could you tell me how to solve it?I'm going crazy!

@usernamezcn
Copy link

我已经更改了wheel和argparse包的版本,并使它们的版本与Ubuntu相同。但是在Windows上运行它时仍然会抛出错误。@GTmac

have you ever solve it?

@asdfhalkehflkajdhf
Copy link

asdfhalkehflkajdhf commented Mar 25, 2019 via email

@asdfhalkehflkajdhf
Copy link

asdfhalkehflkajdhf commented Mar 25, 2019 via email

@usernamezcn
Copy link

你这不是安装成功了吗? 运行错误就自己debug查下吧,这种错误大概率每个人都不一样。 我没遇到数据大小限制,还有AttributeError: 'NoneType' object has no attribute 'nodes' 已经说的很明白了,没有"nodes"属性,查下为什么 | | liuzhuchen | | liuzhuchen@126.com | 签名由网易邮箱大师定制 On 3/25/2019 10:11,子辛notifications@github.com wrote: 好久没有用过。 我记得不用手动更改,有一个环境配置文件,执行下就可以。 | | liuzhuchen | | liuzhuchen@126.com | 签名由网易邮箱大师定制 On 3/25/2019 09:41,子辛notifications@github.com wrote: 我已经更改了wheel和argparse包的版本,并使它们的版本与Ubuntu相同。但是在Windows上运行它时仍然会抛出错误。@GTmac have you ever solve it? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread. 首先感谢回复,万分感谢 您说的是那个文件鸭?是__main__.py还是setup.py文件,刚开始用的是py2,出现了这个问题,改成py3之后这个问题还存在。在安装deepwalk的时候执行了,“pip install -r requirement.txt”和"python setup.py install"将deepwalk安装成功了,之后input数据库的时候就出错了,在执行测试文件karate.adjlist时,没有出现任何错误完美运行。但是执行blogcatalog.mat文件之后就会出现AttributeError: 'NoneType' object has no attribute 'nodes'。会不会是因为数据太大,进入了else语句之后出现的错误,错误提示中有 Data size (walks*length): 32998400 Data size 32998400 is larger than limit (max-memory-data-size: 0). Dumping walks to disk. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

oh no,have you ever seen the problem.The problem i met just as same as the author's.I do't think it's an accident

@ikennaoluigbo
Copy link

import logging
from io import open
from os import path
from time import time
from multiprocessing import cpu_count
import random
from concurrent.futures import ProcessPoolExecutor
from collections import Counter
from six.moves import zip
import graph

logger = logging.getLogger("deepwalk")
__current_graph = None
__vertex2str = None

In the walk module of deepwalk, _current_graph and _vertex2str are both set to None as shown above.
And as a result of this, I get this error "AttributeError: 'NoneType' object has no attribute "nodes" each time I run the codes.
What is the solution to this please?

@githubxiaowei
Copy link

多进程不能共享变量,每个子进程里的 __current_graph 都是 None

@githubxiaowei
Copy link

in walks.py

from concurrent.futures import ThreadPoolExecutor as ProcessPoolExecutor

problem solved! XD

@metehanunal
Copy link

Hi,

I also have a PC with Windows 10. Even if "futures" package is the lastest version, I am getting the same error.

When I write:
deepwalk --format mat --input example_graphs/blogcatalog.mat --max-memory-data-size 0 --number-walks 80 --representation-size 128 --walk-length 40 --window-size 10 --workers 1 --output example_graphs/blogcatalog.embeddings

I get:

Number of nodes: 10312
Number of walks: 824960
Data size (walks*length): 32998400
Data size 32998400 is larger than limit (max-memory-data-size: 0).  Dumping walks to disk.
Walking...
Traceback (most recent call last):
  File "C:\Python27\Scripts\deepwalk-script.py", line 11, in <module>
    load_entry_point('deepwalk==1.0.3', 'console_scripts', 'deepwalk')()
  File "C:\Python27\lib\site-packages\deepwalk-1.0.3-py2.7.egg\deepwalk\__main__.py", line 162, in main
    process(args)
  File "C:\Python27\lib\site-packages\deepwalk-1.0.3-py2.7.egg\deepwalk\__main__.py", line 83, in process
    num_workers=args.workers)
  File "C:\Python27\lib\site-packages\deepwalk-1.0.3-py2.7.egg\deepwalk\walks.py", line 85, in write_walks_to_disk
    for file_ in executor.map(_write_walks_to_disk, args_list):
  File "C:\Python27\lib\site-packages\concurrent\futures\_base.py", line 641, in result_iterator
    yield fs.pop().result()
  File "C:\Python27\lib\site-packages\concurrent\futures\_base.py", line 462, in result
    return self.__get_result()
  File "C:\Python27\lib\site-packages\concurrent\futures\_base.py", line 414, in __get_result
    raise exception_type, self._exception, self._traceback
AttributeError: 'NoneType' object has no attribute 'nodes'

But I found something odd about this issue.
When i write the code with no options like below:

deepwalk --format mat --input example_graphs/blogcatalog.mat --output example_graphs/blogcatalog.embeddings

I get the below output and I think it is successfully completes:

Number of nodes: 10312
Number of walks: 103120
Data size (walks*length): 4124800
Walking...
Training...

I cannot solve the problem with upgrading packages.

My installed list of packages with versions maybe useful with deepwalk:

Cython                   0.29.16
deepwalk                 1.0.3
future                   0.18.2
futures                  3.3.0
gensim                   3.8.1
networkx                 2.2
pip                      20.0.2
scipy                    1.2.3
six                      1.14.0

Could you please help me about this issue?

@xiongshuai520
Copy link

in walks.py
from concurrent.futures import ThreadPoolExecutor as ProcessPoolExecutor
problem solved! XD

YES,it works,help other guys can see it

@tomatowithpotato
Copy link

in walks.py

from concurrent.futures import ThreadPoolExecutor as ProcessPoolExecutor

problem solved! XD

good guy!
好家伙,你咋那么优秀!

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

10 participants