oemof / oemof-solph

A model generator for energy system modelling and optimisation (LP/MILP).
https://oemof.org
MIT License
297 stars 125 forks source link

ImportError: cannot import name 'ScalarBlock' from 'pyomo.core.base.block' #871

Open VincentTasara opened 1 year ago

VincentTasara commented 1 year ago

ImportError Traceback (most recent call last) Input In [1], in <cell line: 5>() 3 import os 4 import time ----> 5 import oemof.solph as solph 6 import oemof.outputlib as outputlib 7 get_ipython().run_line_magic('matplotlib', 'inline')

File ~\Anaconda3\envs\FYP\lib\site-packages\oemof\solph__init.py:3, in 1 version__ = "0.4.5.dev0" ----> 3 from . import buses 4 from . import components 5 from . import constraints

File ~\Anaconda3\envs\FYP\lib\site-packages\oemof\solph\buses__init__.py:12, in 1 # -- coding: utf-8 -- 3 """ 4 This module is designed to hold busses with their classes and 5 associated individual constraints (blocks) and groupings. Therefore this (...) 9 experimental code should be included in oemof.experimental. 10 """ ---> 12 from . import experimental 13 from ._bus import Bus 15 all = [ 16 "experimental", 17 "Bus", 18 ]

File ~\Anaconda3\envs\FYP\lib\site-packages\oemof\solph\buses\experimental__init.py:10, in 1 # -- coding: utf-8 -- 2 """ 3 This module is designed to hold in-development components with their classes 4 and associated individual constraints (blocks) and groupings. (...) 7 so code referred to within this module might not have production quality. 8 """ ---> 10 from ._electrical_bus import ElectricalBus 12 all__ = [ 13 "ElectricalBus", 14 ]

File ~\Anaconda3\envs\FYP\lib\site-packages\oemof\solph\buses\experimental_electrical_bus.py:19, in 1 # -- coding: utf-8 -- 3 """ 4 In-development electrical bus component. 5 (...) 16 17 """ ---> 19 from oemof.solph.buses._bus import Bus 22 class ElectricalBus(Bus): 23 r"""A electrical bus object. Every node has to be connected to BusBlock. 24 This BusBlock is used in combination with ElectricalLine objects 25 for linear optimal power flow (lopf) calculations. (...) 44 45 """

File ~\Anaconda3\envs\FYP\lib\site-packages\oemof\solph\buses_bus.py:22, in 20 from pyomo.core import BuildAction 21 from pyomo.core import Constraint ---> 22 from pyomo.core.base.block import ScalarBlock 25 class Bus(on.Bus): 26 """A balance object. Every node has to be connected to BusBlock. 27 28 The sum of all inputs of a Bus object must equal the sum of all outputs (...) 35 36 """

ImportError: cannot import name 'ScalarBlock' from 'pyomo.core.base.block' (C:\Users\19634883\Anaconda3\envs\FYP\lib\site-packages\pyomo\core\base\block.py)

p-snft commented 1 year ago

As for #872, could you please provide some context. In particular, would you give us the versions of the installed packages. Also, can you please format your report to improve readability?