L2RPN Sandbox, on the case14 file Forum

Go back to competition Back to thread list Post in this thread

> Error running Power_Grid_101 notebook


I have trouble running the "1_Power_Grid_101_notebook". In the second code block, it errors out with "cannot import make_new" because there is no module named "make_new", but I found you just need to import "make", so I bypassed the first error. But there is a second error, where in the third code block, when it tries to plot the imported environment, it errors out with

KeyError Traceback (most recent call last)
<ipython-input-13-aca8c32cbae3> in <module>
----> 1 plot_helper = Plotting(observation_space=environment.observation_space)
3 fig = plot_helper.plot_obs(environment.get_obs())

~/miniconda3/envs/grid2op/lib/python3.6/site-packages/grid2op/Plot/Plotting.py in __init__(self, observation_space, display_mod, substation_layout, radius_sub, load_prod_dist, bus_radius)
41 radius_sub=radius_sub,
42 load_prod_dist=load_prod_dist,
---> 43 bus_radius=bus_radius)
44 self.display_mod = display_mod

~/miniconda3/envs/grid2op/lib/python3.6/site-packages/grid2op/Plot/PlotPlotly.py in __init__(self, observation_space, substation_layout, radius_sub, load_prod_dist, bus_radius)
250 radius_sub=radius_sub,
251 load_prod_dist=load_prod_dist,
--> 252 bus_radius=bus_radius)
253 if not can_plot:
254 raise PlotError("Impossible to plot as plotly cannot be imported. Please install \"plotly\" and "

~/miniconda3/envs/grid2op/lib/python3.6/site-packages/grid2op/Plot/BasePlot.py in __init__(self, observation_space, substation_layout, radius_sub, load_prod_dist, bus_radius)
115 this_sub[l_nm] = this_line
116 self.subs_elements[sub_id] = this_sub
--> 117 self._compute_layout()
119 self.col_line = None

~/miniconda3/envs/grid2op/lib/python3.6/site-packages/grid2op/Plot/BasePlot.py in _compute_layout(self)
426 for el_nm, dict_el in elements.items():
427 if dict_el["type"] == "line":
--> 428 z = dict_el["z"]
429 closest = np.argmin([abs(pos - z)**2 for pos in pos_possible])
430 pos_possible = [el for i, el in enumerate(pos_possible) if i != closest]

KeyError: 'z'

How should I get passed this error?

Posted by: jfang16 @ Sept. 28, 2020, 9:41 p.m.

never mind, I guess the starting kit is outdated. Just look at the documentation, and use "from grid2op.PlotGrid import PlotMatplot" instead

Posted by: jfang16 @ Sept. 28, 2020, 9:53 p.m.

Yes exactly you are totally correct :-)
I will try to put some deprecated warning messages for the use of this old module no more maintained :-)

Posted by: BDonnot @ Sept. 29, 2020, 8:12 a.m.
Post in this thread