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

Example code does not work #70

Closed
mathstream opened this issue Nov 7, 2023 · 2 comments
Closed

Example code does not work #70

mathstream opened this issue Nov 7, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mathstream
Copy link

Describe the bug
The sample code on the website does not work. I am using openbox 0.8.1, Python 3.11.6, on MacOS 13.0 (ARM / M1 architecture)

To Reproduce
from openbox import space as sp
x1 = sp.Real("x1", -5, 10, default_value=0)

or

from openbox import space as sp
x1 = sp.Real("x1", -5.0, 10.0, default_value=0.0)

Expected behavior
The sample code should not throw an exception

Outputs and Logs
If we call sp.Real and supply int values (like the example on the website):

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/alanw/projects/pxsim-clean/.env/HANGAR/lib/python3.11/site-packages/openbox/utils/space.py", line 99, in __init__
super().__init__(name=name, lower=lower, upper=upper,
File "ConfigSpace/hyperparameters.pyx", line 669, in ConfigSpace.hyperparameters.UniformFloatHyperparameter.__init__
TypeError: Argument 'default_value' has incorrect type (expected float, got int)

If we fix it and pass floats, somewhere it's getting converted to numpy values:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/alanw/projects/pxsim-clean/.env/HANGAR/lib/python3.11/site-packages/openbox/utils/space.py", line 99, in __init__ super().__init__(name=name, lower=lower, upper=upper,
File "ConfigSpace/hyperparameters.pyx", line 669, in ConfigSpace.hyperparameters.UniformFloatHyperparameter.__init__
File "ConfigSpace/hyperparameters.pyx", line 731, in ConfigSpace.hyperparameters.UniformFloatHyperparameter.check_default
TypeError: Expected float, got numpy.float64

Additional context
Just trying it for the first time

@jhj0411jhj jhj0411jhj added the bug Something isn't working label Nov 8, 2023
@jhj0411jhj
Copy link
Member

jhj0411jhj commented Nov 8, 2023

Thanks for the issue. It seems to be an incompatibility bug between the ConfigSpace package and python3.11 (or cython). (See automl/ConfigSpace#336) Upgrade Configspace to 0.7.1 will fix it (via pip install ConfigSpace==0.7.1), or use python 3.10 instead. We are doing more test to find a better solution.

@jhj0411jhj
Copy link
Member

This issue is the same as #69 and will be closed. We will continue to track this bug in #69. Please feel free to reopen the issue if you have further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants