rte-france / Grid2Op

Grid2Op a testbed platform to model sequential decision making in power systems.
https://grid2op.readthedocs.io/
Mozilla Public License 2.0
288 stars 116 forks source link

Help with selection of grid2op version for the code I have #510

Closed MuhaoGuo closed 1 year ago

MuhaoGuo commented 1 year ago

I have a grid2op code that I want to run. I was told to try grid2op 1.0.0 version for the code I was given. However, when I run the following line of code env = make("rte_case14_realistic", param=param), I got the following error trace

File "/Users/muhaoguo/Documents/study/Paper_Projects/my_floder/my_floder_G/Codes_datageneration_and_more/my_code.py", line 206, in call_env env = make(str, param=param) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/grid2op/MakeEnv/Make.py", line 267, in make return make_from_path_fn(real_ds_path, **kwargs) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/grid2op/MakeEnv/MakeFromPath.py", line 475, in make_from_dataset_path env = Environment(init_grid_path=grid_path_abs, File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/grid2op/Environment/Environment.py", line 171, in __init__ self.init_backend(init_grid_path, chronics_handler, backend, File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/grid2op/Environment/Environment.py", line 216, in init_backend self.backend.load_grid(self.init_grid_path) # the real powergrid of the environment File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/grid2op/Backend/PandaPowerBackend.py", line 202, in load_grid self._grid = pp.from_json(full_path) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandapower/file_io.py", line 243, in from_json net = json.load(fp, cls=PPJSONDecoder) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/json/__init__.py", line 293, in load return loads(fp.read(), File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/json/__init__.py", line 370, in loads return cls(**kw).decode(s) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandapower/io_utils.py", line 398, in pp_hook df = pd.read_json(obj, precise_float=True, **d) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/util/_decorators.py", line 214, in wrapper return func(*args, **kwargs) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/io/json/_json.py", line 608, in read_json result = json_reader.read() File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/io/json/_json.py", line 731, in read obj = self._get_object_parser(self.data) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/io/json/_json.py", line 753, in _get_object_parser obj = FrameParser(json, **kwargs).parse() File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/io/json/_json.py", line 857, in parse self._parse_no_numpy() File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/io/json/_json.py", line 1097, in _parse_no_numpy self.obj = DataFrame(dtype=None, **decoded) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/core/frame.py", line 490, in __init__ mgr = init_dict({}, index, columns, dtype=dtype) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/core/internals/construction.py", line 239, in init_dict val = construct_1d_arraylike_from_scalar(np.nan, len(index), nan_dtype) File "/Users/muhaoguo/miniconda3/envs/my_env/lib/python3.8/site-packages/pandas/core/dtypes/cast.py", line 1440, in construct_1d_arraylike_from_scalar dtype = dtype.dtype AttributeError: type object 'object' has no attribute 'dtype'

Can you help me find the grid2op version that would not give me this error without making any changes to the code I have? Thank you very much in advance!

BDonnot commented 1 year ago

Hello

First, don't use grid2op version as old as this. We don't support it anymore. Are you sure it does not work with latest version? Have you tried the grid2op "compatibility" mode ?

Second, this sounds more like a pandapower issue: your pandapower version is unable to read the file from the environment which is more or less normal because we never really tested (nor used) this environment :-/ Ça you use the l2rpn_case14_sandbox by any chance?

Also to be more constructive : what are you trying to do? It's probably easier done with most recent versions.

BDonnot commented 1 year ago

Hi,

Has your problem been fixed ? (I'll close the issue if it has been)

MuhaoGuo commented 1 year ago

Yes, the problem was fixed. Thank you for your help!