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

Got "TypeError: 'generator' object is not subscriptable" on my Ubuntu machine #325

Closed
Michael89 opened this issue Sep 20, 2017 · 14 comments
Closed

Comments

@Michael89
Copy link

Hi I'm trining to use your grate lib for tuning hyperparameters for my NN, but for some reason I got this error:

  File "/home/michael/work/oanda/src/oanda/trend_prediction/find_optimal_model.py", line 124, in <module>
    main()
  File "/home/michael/work/oanda/src/oanda/trend_prediction/find_optimal_model.py", line 116, in main
    trials=trials)
  File "/home/michael/work/oanda/runtime/lib/python3.5/site-packages/hyperopt/fmin.py", line 307, in fmin
    return_argmin=return_argmin,
  File "/home/michael/work/oanda/runtime/lib/python3.5/site-packages/hyperopt/base.py", line 635, in fmin
    return_argmin=return_argmin)
  File "/home/michael/work/oanda/runtime/lib/python3.5/site-packages/hyperopt/fmin.py", line 314, in fmin
    pass_expr_memo_ctrl=pass_expr_memo_ctrl)
  File "/home/michael/work/oanda/runtime/lib/python3.5/site-packages/hyperopt/base.py", line 786, in __init__
    pyll.toposort(self.expr)
  File "/home/michael/work/oanda/runtime/lib/python3.5/site-packages/hyperopt/pyll/base.py", line 715, in toposort
    assert order[-1] == expr
TypeError: 'generator' object is not subscriptable

Everything work nice when I tried it on my mac book but when I start it on my desktop (which I build for NN training) I got this error and don't know what to do.

Python 3.5.2
Linux michael-ubuntu 4.10.0-33-generic #37~16.04.1-Ubuntu SMP Fri Aug 11 14:07:2

@Michael89
Copy link
Author

Find a quick fix. I noticed that I have networkx-2.0 version on ubuntu and networkx-1.11 on mac so I just downgrade it on ubuntu and it starts working.

@lferrerg
Copy link

Thanks @Michael89 for your quick fix! I confirm that networkx-2.0 is the culprit of the error and downgrading to version 1.11 does the trick.

@charlesreid1
Copy link

Thanks for this. For anyone wondering how to downgrade:

$ pip install networkx==1.11

@authman
Copy link

authman commented Jan 26, 2018

Seems this is still an issue

@michaelmior
Copy link
Contributor

This was fixed in #319 but you'll either have to run with the code from the repository or wait for the next release.

@juharris
Copy link

Do pip install --upgrade git+git://github.com/hyperopt/hyperopt.git until a new release has been made.

@olddaos
Copy link

olddaos commented Jun 15, 2018

Hi guys!
Looks like it is still an issue on my Mac ( Darwin Kernel Version 16.6.0: Fri Apr 14 16:13:31 PDT 2017; root:xnu-3789.60.24~4/RELEASE_X86_64 x86_64) with Python 3.6.3

Just did 'pip install --upgrade git+git://github.com/hyperopt/hyperopt.git', downgraded networkx but nothing helps...

Thanks in advance for any clues.

@michaelmior
Copy link
Contributor

Don't really see how this would be possible since order is explicitly converted to a list. Can you check that hyperopt/pyll/base.py in your hyperopt installation matches what's in master?

@olddaos
Copy link

olddaos commented Jun 15, 2018 via email

@wernight
Copy link

Wondering what's blocking creating a new release. Having unpinned versions isn't healthy or easy to maintain as general creating a new release is rather easy.

@michaelmior
Copy link
Contributor

I don't have permissions to publish a new release myself, but you can pin your version to a specific git commit. Agreed that a released version would still be great though.

@maxpumperla
Copy link
Contributor

I can do a release next week

@nqnhu1
Copy link

nqnhu1 commented Mar 2, 2022

Have anyone gotten to solve it yet please? I got a similar error 'int' object is not subscriptable. I'm having a hard time trying to figure it out

@michaelmior
Copy link
Contributor

@nqnhu1 Try using the version of hyperopt on the master branch.

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