Couldn't use existing ray cluster from python file - TypeError: can't pickle function objects

Receiving below stack trace when triggering ray.init from python file.

File “sample_new.py”, line 7, in
ray.init(address=‘auto’, _redis_password=‘5241590000000000’)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/ray/_private/client_mode_hook.py”, line 105, in wrapper
return func(*args, **kwargs)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/ray/worker.py”, line 959, in init
job_config=job_config)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/ray/worker.py”, line 1532, in connect
lambda worker_info: sys.path.insert(1, script_directory))
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/ray/worker.py”, line 388, in run_function_on_all_workers
pickled_function = pickle.dumps(function)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/ray/cloudpickle/cloudpickle_fast.py”, line 73, in dumps
cp.dump(obj)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/ray/cloudpickle/cloudpickle_fast.py”, line 620, in dump
return Pickler.dump(self, obj)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/pickle5/pickle.py”, line 485, in dump
self.save(obj)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/pickle5/pickle.py”, line 601, in save
self.save_reduce(obj=obj, *rv)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/pickle5/pickle.py”, line 689, in save_reduce
save(func)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/pickle5/pickle.py”, line 601, in save
self.save_reduce(obj=obj, *rv)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/pickle5/pickle.py”, line 689, in save_reduce
save(func)
File “/home/test/ray_env/new_env/lib/python3.6/site-packages/pickle5/pickle.py”, line 576, in save
rv = reduce(self.proto)
TypeError: can’t pickle function objects

versions:
python 3.6.3
ray 1.9.2

Ray was started manually from terminal with port 6378. Trying to execute sample python file from head server itself. Kindly help me to resolve this.

Could you upgrade your python version to 3.6.13 or even 3.7+? TypeError: can't pickle function objects · Issue #27820 · ray-project/ray · GitHub

@jjyao is there any workaround to achieve this in python version 3.6.3. looks like upgrading python is not a easy deal for us.

I’m not aware of any workaround. @suquark do you know?