Closed rbolgaryn closed 6 months ago
Hello,
Sorry about that. I'll make sure to: 1) fix it asap 2) make a test in lightsim2grid CI that everything works well even if grid2op is not installed
Lightsim2grid should not depend on grid2op.
Fixed (and test added so that it does not break in the future) in release 0.8.1 that I just uploaded on pypi (might take a bit before being seen everywhere)
Super, thank you very much!
Environment
x.y.z
(eg 1.4.0)0.8.0
(eg 0.5.0)GutHub Actions for Windows.
Bug description
As seen below in the log from pytest, if we try importing ContingencyAnalysisCPP (from lightsim2grid.securityAnalysis import ContingencyAnalysisCPP), and grid2op is not installed, there is an ImportError.
Can you please add grid2op to the required packages for lightsim2grid, or change lightsim2grid imports so that importing ContingencyAnalysisCPP does not require grid2op (preferred)?
Here the error traceback:
==================================== ERRORS ==================================== _ ERROR collecting pandapower/test/contingency/test_contingency.py ___ ImportError while importing test module '/home/runner/work/pandapower/pandapower/pandapower/test/contingency/test_contingency.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/importlib/init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) pandapower/test/contingency/test_contingency.py:15: in
import pandapower.contingency
pandapower/contingency/init.py:1: in
from pandapower.contingency.contingency import *
pandapower/contingency/contingency.py:14: in
from lightsim2grid.securityAnalysis import ContingencyAnalysisCPP
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/lightsim2grid/securityAnalysis.py:9: in
from lightsim2grid.contingencyAnalysis import ContingencyAnalysisCPP, ContingencyAnalysis
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/lightsim2grid/contingencyAnalysis.py:18: in
from lightsim2grid.lightSimBackend import LightSimBackend
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/lightsim2grid/lightSimBackend.py:16: in
from grid2op.Action import CompleteAction
E ModuleNotFoundError: No module named 'grid2op'