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

TypeError: Descriptors cannot not be created directly. #36417

Open
FrancescoMandru opened this issue Jun 14, 2023 · 3 comments
Open

TypeError: Descriptors cannot not be created directly. #36417

FrancescoMandru opened this issue Jun 14, 2023 · 3 comments
Labels
bug Something that is supposed to be working; but isn't core Issues that should be addressed in Ray Core P2 Important issue, but not time-critical stability

Comments

@FrancescoMandru
Copy link

FrancescoMandru commented Jun 14, 2023

I was running your example code after upgrading to ray 2.5.0, but now I get the following error.

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

I don't understand why I have to downgrade protobuf ti much older versions. Any suggestion? This error disappear if I use older versions of Ray

Versions / Dependencies

ray = {extras = ["tune"], version = "^2.5.0"}
python = "^3.10"

Reproduction script

from ray import tune

def objective(config): # ①
score = config["a"] ** 2 + config["b"]
return {"score": score}

search_space = { # ②
"a": tune.grid_search([0.001, 0.01, 0.1, 1.0]),
"b": tune.choice([1, 2, 3]),
}

tuner = tune.Tuner(objective, param_space=search_space) # ③

results = tuner.fit()
print(results.get_best_result(metric="score", mode="min").config)

Issue Severity

Medium: It is a significant difficulty but I can work around it.

@FrancescoMandru FrancescoMandru added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Jun 14, 2023
@FrancescoMandru
Copy link
Author

Update: It seems that with new versions of proto every Ray version have the same problem.

@xieus xieus added the tune Tune-related issues label Jun 20, 2023
@krfricke krfricke added P1 Issue that should be fixed within a few weeks core Issues that should be addressed in Ray Core and removed tune Tune-related issues air labels Jun 21, 2023
@matthewdeng
Copy link
Contributor

Can you share the full stack trace? This might be due to other dependencies (perhaps getting pulled in as extras).

@hora-anyscale hora-anyscale removed the triage Needs triage (eg: priority, bug/not-bug, and owning component) label Jun 21, 2023
@jjyao
Copy link
Collaborator

jjyao commented Feb 20, 2024

@FrancescoMandru do you still see this error with latest Ray?

@jjyao jjyao added P2 Important issue, but not time-critical and removed P1 Issue that should be fixed within a few weeks labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't core Issues that should be addressed in Ray Core P2 Important issue, but not time-critical stability
Projects
None yet
Development

No branches or pull requests

7 participants