TypeError: cannot pickle 'property' object

When running locally I keep getting this error “TypeError: cannot pickle ‘property’ object”. It seems to be thrown by cloudpickle when the procgen env wrapper is registering the environment

registry.register_env(
    "procgen_env_wrapper",
    lambda config: ProcgenEnvWrapper(config)
)

I’m on Mac OS and have installed the correct dependencies. It even happens when I install a fresh copy of the starter kit. Any help is appreciated!

2 Likes

Hi, can you share the command you executed which showed TypeError?

I’ve tried both ./run.sh --train and bash run.sh --train

Thanks, I thought you might be doing something else. We have done most of the testing in Mac OS so this shouldn’t happen ideally.

In that case, can you please share complete traceback, it will help us to debug issue?

Traceback (most recent call last):
  File "train.py", line 41, in <module>
    load_envs(os.getcwd()) # Load envs
  File "/Users/gregeales/Desktop/Repositories/NeurIPS-2020-Procgen-Competition/utils/loader.py", line 62, in load_envs
    _source_file(_file_path)
  File "/Users/gregeales/Desktop/Repositories/NeurIPS-2020-Procgen-Competition/utils/loader.py", line 22, in _source_file
    loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/gregeales/Desktop/Repositories/NeurIPS-2020-Procgen-Competition/envs/procgen_env_wrapper.py", line 67, in <module>
    registry.register_env(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ray/tune/registry.py", line 86, in register_env
    _global_registry.register(ENV_CREATOR, name, env_creator)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ray/tune/registry.py", line 112, in register
    self._to_flush[(category, key)] = pickle.dumps(value)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ray/cloudpickle/cloudpickle_fast.py", line 72, in dumps
    cp.dump(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ray/cloudpickle/cloudpickle_fast.py", line 617, in dump
    return Pickler.dump(self, obj)
TypeError: cannot pickle 'property' object
1 Like

Additional Info: I’m running python 3.8 and am executing the command inside the project folder. Let me know if theres any other info I can give. I appreciate the help!

Hello @gregory_eales, can you downgrade to python 3.7/3.6 and try again? There is a known issue with cloudpickle and python 3.8.

4 Likes

@jyotish that fixed the issue, thanks for the help.

1 Like