# Ray.init not work, but ray job submit is

**URL:** <https://discuss.ray.io/t/ray-init-not-work-but-ray-job-submit-is/15327>\
**Category:** Uncategorized\
**Created:** [July 24, 2024, 7:27am UTC](https://discuss.ray.io/t/ray-init-not-work-but-ray-job-submit-is/15327 "2024-07-24T07:27:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xydote](https://avatars.discourse-cdn.com/v4/letter/x/ecb155/32.png) [@xydote](https://discuss.ray.io/u/xydote)\
**Post date:** [July 24, 2024, 7:27am UTC](https://discuss.ray.io/t/ray-init-not-work-but-ray-job-submit-is/15327/1 "2024-07-24T07:27:14Z")

</div>

Do you know how I can run this Python script on the Ray cluster without using `ray job submit`?

```auto
from collections import Counter
import socket
import time
import ray ray.init()
@ray.remote 
def f(): 
    time.sleep(0.001) # Return IP address. 
    return socket.gethostbyname(socket.gethostname())
object_ids = [f.remote() for _ in range(100)] 
ip_addresses = ray.get(object_ids) print(Counter(ip_addresses))

```

At the moment I use scripts like the following to execute on the cluster. But I would prefer to do it without the script so that I can execute from Spyder, Jupyter or other interactive environments.

```auto

export RAY_ADDRESS="[http://192.168.26.185:30002](http://192.168.26.185:30002/)" runtime_env="..."
cd $HOME/PycharmProjects/abcd/
script="scripts/ray/script.py"

ray job submit --runtime-env "$runtime_env" python3.9 "$script"

```

I get this error:

AssertionError: Module: http does not have ClientBuilder.

I’ve also tried removing http:// from the front of RAY\_ADDRESS, and changing http:// to ray://, but neither of those work.

---

<div class="post-metadata">

**Author:** ![xydote](https://avatars.discourse-cdn.com/v4/letter/x/ecb155/32.png) [@xydote](https://discuss.ray.io/u/xydote)\
**Post date:** [July 24, 2024, 7:30am UTC](https://discuss.ray.io/t/ray-init-not-work-but-ray-job-submit-is/15327/2 "2024-07-24T07:30:20Z")

</div>

This is what happens if I remove ray://

| 2024-07-24 08:26:30,908 | WARNING utils.py:1401 – Unable to connect to GCS (ray head) at 192.168.26.183:30022. Check that (1) Ray with matching version started successfully at the specified address, (2) this node can reach the specified address, and (3) there is no firewall setting preventing access. |
| --- | --- |
| 2024-07-24 08:26:37,943 | ERROR utils.py:1395 – Failed to connect to GCS. Please check `gcs_server.out` for more details. |

---

<div class="post-metadata">

**Author:** ![Sam\_Chan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sam_chan/32/5011_2.png) [@Sam\_Chan](https://discuss.ray.io/u/Sam_Chan)\
**Post date:** [July 29, 2024, 3:51pm UTC](https://discuss.ray.io/t/ray-init-not-work-but-ray-job-submit-is/15327/3 "2024-07-29T15:51:29Z")

</div>

Does `ray job submit` from jupyter not work; you can execute them there not necessarily from the CLI.

---

<div class="post-metadata">

**Author:** ![Kai-Hsun\_Chen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/kai-hsun_chen/32/3760_2.png) [@Kai-Hsun\_Chen](https://discuss.ray.io/u/Kai-Hsun_Chen)\
**Post date:** [July 29, 2024, 4:22pm UTC](https://discuss.ray.io/t/ray-init-not-work-but-ray-job-submit-is/15327/4 "2024-07-29T16:22:45Z")

</div>

`ray job submit` connects to the Ray dashboard port (8265 in most cases), while `ray.init` connects to the Ray GCS (6379 in most cases). The GCS port is typically only available on the Ray head node. Are you running `ray.init` on the Ray head node?
