How to change default address for ray.init()

How severe does this issue affect your experience of using Ray?

  • High: It blocks me to complete my task.

Need to change the default address. Integrating with another application as a plugin has its own scheduler using rays default address. This causes ray workers/actors to be canceled/killed before processing is complete.

You can set the OS environment variable RAY_ADDRESS to override the ray.init() address.

Thanks I will give that a try.

Alas it does not seem to work.

Is it just the IP address or is IP Address:PORT that should be expressed. If port should be added what is the default?

  File "D:\apps\vec\formatters\", line 20, os.environ["RAY_ADDRESS"] = ""
  File "D:\apps\vec\ingestors\", line 33, in __init__
    ray.init(local_mode=False, ignore_reinit_error=True, _temp_dir=ray_session_path)
  File "d:\venv\lib\site-packages\ray\_private\", line 105, in wrapper
    return func(*args, **kwargs)
  File "d:\venv\lib\site-packages\ray\", line 975, in init
  File "d:\venv\lib\site-packages\ray\", line 166, in __init__
  File "d:\venv\lib\site-packages\ray\", line 302, in validate_ip_port
    _ = int(port)
ValueError: invalid literal for int() with base 10: ''


I added a port number, so that exception above goes away. Now I get warning and the code will not function.

2022-03-21 12:18:51,604 WARNING -- Unable to connect to GCS at Check that (1) Ray GCS with matching version started successfully at the specified address, and (2) there is no firewall setting preventing access.

At this point I do not see a way to use just RAY_ADDRESS to change the default address it is using. When I allow both the DASK scheduler to use the same address my code does work however there is a performance penalty.

Hmm I think I misunderstood your original question. RAY_ADDRESS is used to specify the address that the Ray driver/client should connect to, but it assumes that there is already a Ray instance running there.

Try using ray start --head --port <custom port or 0 to choose a random one> to start a Ray instance, then you can connect to it with ray.init(address="auto").

Currently the ray app is embedded as a package and not separate instance that is running.

Hmm not sure I understand the issue you’re running into. Are you just using ray.init() to start Ray? This should choose a random port, so I’m not sure how you’re getting a port conflict. What version of Ray are you using?

Running version 1.11.0 and yes running ray.init() on initialization of the Class instance that other app invokes.

Just need ability to have it use a different IP address than when you run with ray.init().