Yelp / MOE

A global, black box optimization engine for real world metric optimization.
Other
1.31k stars 139 forks source link

PositiveFloat() takes 2 arguments (1 given) #413

Closed rmcgibbo closed 9 years ago

rmcgibbo commented 9 years ago

I'm just getting started with MOE, and ran into the following snap: after installing (Ubuntu 14.04), and running some of the examples in moe_examples/, I get the following traceback on import:

rmcgibbo@vspm9  ~/local/MOE () ‹master› 
$ cd moe_examples 
rmcgibbo@vspm9  ~/local/MOE/moe_examples () ‹master› 
$ python blog_post_example_ab_testing.py
Traceback (most recent call last):
  File "blog_post_example_ab_testing.py", line 18, in <module>
    from moe.easy_interface.bandit_simple_endpoint import bandit as bandit_endpoint
  File "/home/rmcgibbo/miniconda/lib/python2.7/site-packages/moe/easy_interface/bandit_simple_endpoint.py", line 9, in <module>
    from moe.easy_interface.simple_endpoint import call_endpoint_with_payload, DEFAULT_HOST, DEFAULT_PORT
  File "/home/rmcgibbo/miniconda/lib/python2.7/site-packages/moe/easy_interface/simple_endpoint.py", line 10, in <module>
    from moe.views.schemas.gp_next_points_pretty_view import GpNextPointsResponse
  File "/home/rmcgibbo/miniconda/lib/python2.7/site-packages/moe/views/schemas/gp_next_points_pretty_view.py", line 6, in <module>
    from moe.views.schemas import base_schemas
  File "/home/rmcgibbo/miniconda/lib/python2.7/site-packages/moe/views/schemas/base_schemas.py", line 63, in <module>
    class ListOfPositiveFloats(colander.SequenceSchema):
  File "/home/rmcgibbo/miniconda/lib/python2.7/site-packages/moe/views/schemas/base_schemas.py", line 67, in ListOfPositiveFloats
    float_in_list = PositiveFloat()
TypeError: __init__() takes at least 2 arguments (1 given)
rmcgibbo commented 9 years ago

(This is with the current master, f53f45a645f7ef3f739519445148b1024724d173)

rmcgibbo commented 9 years ago

Oh, nevermind. This comes from running an older version of colander (0.9.9).

suntzu86 commented 9 years ago

Do you have a suggestion on how to make this error more obvious? Like I could add a version check after importing colander that emits a more helpful error message.

I only ask b/c you're far from the first person to run into this. Might be worth making it more clear to future users.

rmcgibbo commented 9 years ago

If colander had a__version__ attribute in the package, that would be nice. Perhaps

if len(inspect.getargspec(colander.SchemaNode.__init__).args) > 1:
    warnings.warn('It looks like your version of colander is too old!')

is a super-hacky alternative. I don't think there's a "good" answer, since your requirements file already lists the version you want.