On my Mac the code works just fine btu on two Ubuntu machines I get this traceback. Any suggestions on what could be causing this?
Traceback (most recent call last):
File "./fit.py", line 102, in
best = fmin(experiment, gHyperoptSpace, algo=tpe.suggest, max_evals=len(trials)+1, trials=trials)
File "/usr/local/lib/python2.7/dist-packages/hyperopt/fmin.py", line 307, in fmin
return_argmin=return_argmin,
File "/usr/local/lib/python2.7/dist-packages/hyperopt/base.py", line 635, in fmin
return_argmin=return_argmin)
File "/usr/local/lib/python2.7/dist-packages/hyperopt/fmin.py", line 314, in fmin
pass_expr_memo_ctrl=pass_expr_memo_ctrl)
File "/usr/local/lib/python2.7/dist-packages/hyperopt/base.py", line 786, in __init__
pyll.toposort(self.expr)
File "/usr/local/lib/python2.7/dist-packages/hyperopt/pyll/base.py", line 715, in toposort
assert order[-1] == expr
TypeError: 'generator' object has no attribute '__getitem__'
I had the same problem, although both my machines are running Ubuntu OS. One had an older copy of hyperopt.
In the error above you can see that the issue is with toposort. Looking through recent commits on hyperopt, I noticed this.
Updating my hyperopt code to reflect this change has fixed the error for me!
Thanks, I did see that post and was confused because I found a package called python-networkx with version 1.11_ubuntu1 on my machine. "pip search networkx|grep networkx" revealed I was indeed on version 2.0. So I ran: "sudo pip install networkx==1.11" and all is fine now.
I got the same issue. Something weird is the same code failed on windows python but works on ubuntu python. both has hyperopt v0.1
Changing to python-networkx version 1.11 worked for me
I still see this issue on using networkx 2.0. Is there a follow up to resolve this so that separately installing networkx 1.11 is not needed anymore?
thanks to ericvrp
"sudo pip install networkx==1.11" fixed my problem
downgrading networkx works well!
Downgrading networkx to 1.11 is still fixing the error. Worked on Linux Mint 18.2
Thanks ericvrp!
Most helpful comment
Thanks, I did see that post and was confused because I found a package called python-networkx with version 1.11_ubuntu1 on my machine. "pip search networkx|grep networkx" revealed I was indeed on version 2.0. So I ran: "sudo pip install networkx==1.11" and all is fine now.