Skip to content

Cannot import UtilityFunction #544

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

Closed
DorianP-cmd opened this issue Feb 4, 2025 · 6 comments
Closed

Cannot import UtilityFunction #544

DorianP-cmd opened this issue Feb 4, 2025 · 6 comments

Comments

@DorianP-cmd
Copy link

Hello!
I encountered this error, that I cannot import the UtilityFuntion.

"ImportError: cannot import name 'UtilityFunction' from 'bayes_opt.util' (C:\Users\doria\AppData\Roaming\Python\Python313\site-packages\bayes_opt\util.py)"

Is it not available on version 1.0.1 or was it moved somewhere?

Thanks in advance

@till-m
Copy link
Member

till-m commented Feb 5, 2025

Hi @DorianP-cmd,

the function exists in util.py in v1.0.1. Link.

Are you sure you're using v1.0.1? It's a very old release.

@till-m
Copy link
Member

till-m commented Feb 24, 2025

I assume the problem is fixed. Feel free to re-open if you encounter it again.

@till-m till-m closed this as completed Feb 24, 2025
@SeiDPierre
Copy link

Hello, I have the same issue. I installed with pip. I checked for the class in util.py but could not find it...
I have version 2.0.3.
Thanks in advance,
Pierre

@SeiDPierre
Copy link

It looks like it was removed when the API changed during July of 2024: a6697aa

@till-m
Copy link
Member

till-m commented Mar 6, 2025

Hey @SeiDPierre,

this is indeed the case. You can install an older version (pre 2.0 should be fine). Why do you need the UtilityFunction? Are you using a package that depends on bayesian-optimization? If yes, the package should have it's dependencies defined including the version.

@SeiDPierre
Copy link

In deed, I had a look at version just before 2 and everything I need is there. I agree with you regarding versioning héhé. I'm just dealing with a new project that need some serious cleaning. Thanks for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants