ray icon indicating copy to clipboard operation
ray copied to clipboard

TypeError: Descriptors cannot not be created directly.

Open FrancescoMandru opened this issue 2 years ago • 1 comments

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 avatar Jun 14 '23 11:06 FrancescoMandru

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

FrancescoMandru avatar Jun 15 '23 11:06 FrancescoMandru

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

matthewdeng avatar Jun 21 '23 19:06 matthewdeng

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

jjyao avatar Feb 20 '24 23:02 jjyao