
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
grid2op
Advanced tools
Grid2Op is a platform, built with modularity in mind, that allows to perform powergrid operation. And that's what it stands for: Grid To Operate. It is used as a library used for the Learning To Run Power Network L2RPN, but also for research purpose (especially by the Reinforcement Learning community applied to power system)
This framework allows to perform most kind of powergrid operations, from modifying the setpoint of generators, to load shedding, performing maintenance operations or modifying the topology of a powergrid to solve security issues.
Official documentation: the official documentation is available at https://grid2op.readthedocs.io/.
cd my-project-folder
pip3 install -U virtualenv
python3 -m virtualenv venv_grid2op
source venv_grid2op/bin/activate
pip3 install grid2op
git clone https://github.com/grid2op/Grid2Op.git
cd Grid2Op
pip3 install -U .
cd ..
git clone https://github.com/grid2op/Grid2Op.git
cd Grid2Op
pip3 install -e .
pip3 install -e .[optional]
pip3 install -e .[docs]
Grid2Op docker containers are available on dockerhub.
To install the latest Grid2Op container locally, use the following:
docker pull bdonnot/grid2op:latest
Built with modulartiy in mind, Grid2Op is a library used for the "Learning To Run Power Network" L2RPN competitions series. It can also
Its main features are:
Grid2Op relies on an open source powerflow solver (PandaPower), but is also compatible with other Backend. If you have at your disposal another powerflow solver, the documentation of grid2op/Backend can help you integrate it into a proper "Backend" and have Grid2Op using this powerflow instead of PandaPower.
As of writing, the publically availavble solvers are:
Some Jupyter notebook are provided as tutorials for the Grid2Op package. They are located in the getting_started directories.
TODO: this needs to be redone, refactorize and better explained for some of them.
These notebooks will help you in understanding how this framework is used and cover the most interesting part of this framework:
Runner class to assess how well an agent is performing rapidly.Try them out in your own browser without installing
anything with the help of mybinder:
Or thanks to google colab (all links are provided near the notebook description)
If you use this package in one of your work, please cite:
@software{grid2op,
author = {B. Donnot},
title = {{Grid2op- A testbed platform to model sequential decision making in power systems. }},
url = {\url{https://GitHub.com/Grid2Op/grid2op}},
year = {2020},
publisher = {GitHub},
}
The official documentation is available at https://grid2op.readthedocs.io/.
A copy of the documentation can be built if the project is installed from source: you will need Sphinx, a Documentation building tool, and a nice-looking custom Sphinx theme similar to the one of readthedocs.io. These can be installed with:
pip3 install -U grid2op[docs]
This installs both the Sphinx package and the custom template.
Then, on systems where make is available (mainly gnu-linux and macos) the documentation can be built with the command:
make html
For windows, or systems where make is not available, the command:
sphinx-build -b html docs documentation
This will create a "documentation" subdirectory and the main entry point of the document will be located at index.html.
It is recommended to build this documentation locally, for convenience. For example, the "getting started" notebooks referenced some pages of the help.
Please consult the "CONTRIBUTING.md" file for extra information. This is a summary and
in case of conflicting instructions, follow the one given in the CONTRIBUTING.md file
and discard these ones.
We welcome contributions from everyone. They can take the form of pull requests for smaller changed. In case of a major change (or if you have a doubt on what is "a small change"), please open an issue first to discuss what you would like to change.
To contribute to this code, you need to:
1.6.5 you need to synch your repo with the branch named dev_1.6.6 or dev_1.7.0 (if
the branch dev_1.6.6 does not exist). It will be the highest number in the branches dev_* on
grid2op official github repository.Code in the contribution should pass all the tests, have some dedicated tests for the new feature (if applicable) and documentation (if applicable).
Before implementing any major feature, please write a github issue first.
Grid2op is currently tested on windows, linux and macos.
The unit tests includes testing, on linux machines the correct integration of grid2op with:
On all of these cases, we tested grid2op on all available numpy versions >= 2.0 (nb available numpy versions depend on python version).
The complete test suit is run on linux with the latest numpy version on python 3.12.
Due to the underlying behaviour of the "multiprocessing" package on windows based python versions, the "multiprocessing" of the grid2op "Runner" is not supported on windows. This might change in the future, but it is currently not on our priorities.
A quick fix that is known to work include to set the experimental_read_from_local_dir when creating the
environment with grid2op.make(..., experimental_read_from_local_dir=True) (see doc for more information)
Sometimes, on some configuration (python version) we do not recommend to use grid2op with pandas>=2.2 If you encounter any trouble, please downgrade to pandas<2.2. This behaviour occured in our continuous integration environment for python >=3.9 but could not be reproduced locally.
From grid2op 1.12.1, the python 3.8 install is a bit more complicated.
If you want to install it from source, you have to delete "pyproject.toml" file.
Then rename the "pyproject_38.toml" file to (new name) "pyproject.toml".
Finally "pip install grid2op" normally.
This is due to the "cleaning" of the installation process that now uses only pyproject.toml. And because pyproject has changed the way it identifies "licenses" (before it uses "license" with a table, but this way is deprecated, now it uses "license-files", but it is not supported by a setuptools usable in python 3.8)
Some version of grid2op (eg 1.6.3) are not compatible with python 3.10 or 3.11.
Either use python version 3.8 or 3.9 or upgrade grid2op (1.6.5 works) if that is the case.
Provided that Grid2Op is installed from source:
pip3 install -U grid2op[optional]
cd grid2op/tests
python3 -m unittest discover
Copyright 2019-2020 RTE France RTE: http://www.rte-france.com
This Source Code is subject to the terms of the Mozilla Public License (MPL) v2 also available here
FAQs
An gymnasium compatible environment to model sequential decision making for powersystems
We found that grid2op demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.