How to use TreeObsForRailEnv in remote client?

When I initialize a TreeObsForRailEnv and pass it as the obs_builder_obj for the remote client, I get the following error:

# Relevant code chunk
tree_observation = TreeObsForRailEnv(max_depth=2)
observation, info = remote_client.env_create(obs_builder_object=tree_observation)
# Error
Traceback (most recent call last):
  File "", line 90, in <module>
  File "/anaconda/envs/flatland-rl/lib/python3.6/site-packages/flatland/evaluators/", line 200, in env_create
    _response = self._remote_request(_request)
  File "/anaconda/envs/flatland-rl/lib/python3.6/site-packages/flatland/evaluators/", line 165, in _remote_request
    raise Exception(str(_response["payload"]))
Exception: {'type': 'FLATLAND_RL.ERROR', 'payload': "'current_episode_controller_inference_time_min'"}

Hey @seungjaeryanlee,

It’s hard to say seeing only this part of the code. Could you point me to a (potentially private) repo with the full code?

I suspect this is a bug in the current pip version of Flatland which happens if a timeout occurs during the first timestep of an episode.

Are you maybe taking too long to do the first step after creating the env (timeout of 5min)? or to take the first step afterward (timeout of 5sec)?

hello,have you solved this problem? please give me some advice, thanks.

It is still not clear to me what this error is about, we could look more into it if we had a code sample or link to a gitlab issue where it occurs.

I stumbled over this thread getting the following error when trying to start

flatland-evaluator --tests ./scratch/test-envs

[‘Test_0/Level_0.pkl’, ‘Test_3/Level_0.pkl’, ‘Test_3/Level_1.pkl’, ‘Test_13/Level_1.pkl’, ‘Test_1/Level_1.pkl’, ‘Test_8/Level_1.pkl’, ‘Test_6/Level_0.pkl’, ‘Test_10/Level_0.pkl’, ‘Test_2/Level_1.pkl’, ‘Test_5/Level_0.pkl’, ‘Test_4/Level_0.pkl’, ‘Test_6/Level_1.pkl’, ‘Test_9/Level_1.pkl’, ‘Test_11/Level_0.pkl’, ‘Test_7/Level_1.pkl’, ‘Test_10/Level_1.pkl’, ‘Test_0/Level_1.pkl’, ‘Test_5/Level_1.pkl’, ‘Test_8/Level_0.pkl’, ‘Test_12/Level_0.pkl’, ‘Test_1/Level_0.pkl’, ‘Test_12/Level_1.pkl’, ‘Test_11/Level_1.pkl’, ‘Test_2/Level_0.pkl’, ‘Test_9/Level_0.pkl’, ‘Test_7/Level_0.pkl’, ‘Test_13/Level_0.pkl’, ‘Test_4/Level_1.pkl’]
Listening at : flatland-rl::FLATLAND_RL_SERVICE_ID::commands
Evaluating : Test_0/Level_0.pkl
Evaluating : Test_3/Level_0.pkl
~/anaconda3/envs/flatland-rl-mw-cpu/lib/python3.7/site-packages/pandas/core/ SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation:
self[name] = value
Error : ‘current_episode_controller_inference_time_min’
Traceback (most recent call last):
File “~/anaconda3/envs/flatland-rl-mw-cpu/lib/python3.7/site-packages/flatland/evaluators/”, line 865, in run
File “~/anaconda3/envs/flatland-rl-mw-cpu/lib/python3.7/site-packages/flatland/evaluators/”, line 514, in handle_env_create
File “~/anaconda3/envs/flatland-rl-mw-cpu/lib/python3.7/site-packages/flatland/evaluators/”, line 312, in update_evaluation_metadata
KeyError: ‘current_episode_controller_inference_time_min’

I solved this by calling

redis-cli FLUSHALL

I thought I share this, maybe this is helping someone.


The first thing you should understand is that SettingWithCopyWarning is a warning, and not an error. The real problem behind the warning is that it is generally difficult to predict whether a view or a copy is returned. In most cases, the warning was raised because you have chained two indexing operations together. The SettingWithCopyWarning was created to flag “chained assignment” operations. This is made easier to spot because you might be used [] (square brackets) twice, but the same would be true if you used other access methods such as .loc[] , .iloc[] and so on.

Moreover, you can change the behaviour of SettingWithCopyWarning warning using pd.options.mode.chained_assignment with three option “None/raise”/“warn”.