Ray client crashing with sys.excepthook upon exit

I am trying to use ray client to a remote cluster. With the basic example below, it works through printing the results, but upon exit, it crashes with:

AttributeError: ‘NoneType’ object has no attribute ‘ray’
Exception ignored in: ‘ray._raylet.ClientObjectRef.dealloc
AttributeError: ‘NoneType’ object has no attribute ‘ray’
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:

Can anybody suggest a fix or workaround?

#!/usr/bin/env python3


import ray
import time
import os
import sys

rayInst = ray.init(‘ray://’)

def f(x):
return f’{x}->{os.uname()[1]}’

result_ids =
for i in range(4):

results = ray.get(result_ids) # [0, 1, 2, 3]


I’m really stuck on this …
Does anybody have any suggestions?
This simple example works, but but it crashes upon exiting.
Nothing I’ve tried seems to prevent this.

Hi @varga , what is the Ray and Python versions?

Python 3.9.11
ray, version 1.6.0

Would trying this in a newer version of Ray possible? e.g. Ray 1.11.0

Thanks so much for your help.
I’ve been using the latest anaconda installation and assumed (incorrectly) that I was getting the latest version of ray installed.
Based on your suggestion, I used pip to install the latest 1.11.0 version.
This fixes the problem I was having with the ray client!
Again, thanks for your help.