rafguns / linkpred

Easy link prediction tool
Other
140 stars 46 forks source link

error when running linkpred from terminal #21

Closed StefanBloemheuvel closed 5 years ago

StefanBloemheuvel commented 5 years ago

Hi Rafguns,

I get an error when trying to run linkpred from the mac terminal. The errors says: object of type generator has no len().

the complete error is this:


Stefans-MacBook-Air:lib stefan$ linkpred /Users/stefan/linkprediction/network1.graphml -p SimRank --output recall-precision 14:50:06 - INFO - Reading file '/Users/stefan/linkprediction/network1.graphml'... 14:50:06 - INFO - Successfully read file. 14:50:06 - INFO - Starting preprocessing... Traceback (most recent call last): File "/Users/stefan/anaconda3/bin/linkpred", line 64, in main() File "/Users/stefan/anaconda3/bin/linkpred", line 57, in main linkpred.preprocess() File "/Users/stefan/anaconda3/lib/python3.7/site-packages/linkpred/linkpred.py", line 169, in preprocess self.training = preprocessed(self.training) File "/Users/stefan/anaconda3/lib/python3.7/site-packages/linkpred/linkpred.py", line 163, in without_selfloops(G), minimum=self.config['min_degree']) File "/Users/stefan/anaconda3/lib/python3.7/site-packages/linkpred/preprocess.py", line 85, in without_selfloops "Removing...".format(len(loops))) TypeError: object of type 'generator' has no len() Stefans-MacBook-Air:lib stefan$


Do you perhaps know what i am doing wrong here?

Kind regards,

Stefan Bloemheuvel

rafguns commented 5 years ago

It seems like you're running an older version of linkpred with a newer version of networkx. Can you upgrade linkpred like this? That should solve the problem you're encountering.

$ pip install --upgrade linkpred
StefanBloemheuvel commented 5 years ago

hmm, i upgraded but now i can't get the linkpred --help command running. i should be in /anaconda3/lib/linkpred/ right? going to /anaconda/lib/python3.7/site-packages/linkpred/ won't work either. I am also quite new to using the command line (normally work in python and r) so if i am missing something crucial let me know! thanks for the help in advance!

rafguns commented 5 years ago

Hi Stefan, the linkpred executable should be located in the directory for Python executables on your system/environment. Where exactly that is depends on your system and Python installation. Judging by the traceback you posted earlier, it seems like it should be here: /Users/stefan/anaconda3/bin/linkpred.

Can you run /Users/stefan/anaconda3/bin/linkpred --help for instance?

rafguns commented 5 years ago

Closing for now. Please reopen if this issue is not resolved.