diff --git a/etrago/tools/constraints.py b/etrago/tools/constraints.py index 1a2b5a71..17a7716c 100755 --- a/etrago/tools/constraints.py +++ b/etrago/tools/constraints.py @@ -21,9 +21,9 @@ """ Constraints.py includes additional constraints for eTraGo-optimizations """ +import os import logging -from egoio.tools import db from pyomo.environ import Constraint from pypsa.descriptors import expand_series from pypsa.linopt import define_constraints, define_variables, get_var, linexpr @@ -32,6 +32,9 @@ import pandas as pd import pyomo.environ as po +if "READTHEDOCS" not in os.environ: + from egoio.tools import db + logger = logging.getLogger(__name__) __copyright__ = ( diff --git a/etrago/tools/network.py b/etrago/tools/network.py index 97ffbfe7..3a1e2c89 100644 --- a/etrago/tools/network.py +++ b/etrago/tools/network.py @@ -22,13 +22,16 @@ Define class Etrago """ +import os import logging -from egoio.tools import db from pypsa.components import Network from sqlalchemy.orm import sessionmaker import pandas as pd +if "READTHEDOCS" not in os.environ: + from egoio.tools import db + from etrago import __version__ from etrago.cluster.disaggregation import run_disaggregation from etrago.cluster.electrical import ehv_clustering, run_spatial_clustering diff --git a/etrago/tools/utilities.py b/etrago/tools/utilities.py index 47ac8916..cf52b576 100755 --- a/etrago/tools/utilities.py +++ b/etrago/tools/utilities.py @@ -29,7 +29,6 @@ import math import os -from egoio.tools import db from pyomo.environ import Constraint, PositiveReals, Var from shapely.geometry import Point import geopandas as gpd @@ -38,6 +37,9 @@ import pypsa import sqlalchemy.exc +if "READTHEDOCS" not in os.environ: + from egoio.tools import db + logger = logging.getLogger(__name__)