Import Pypsa Error

18 views
Skip to first unread message

Amin Shokri

unread,
Nov 30, 2022, 5:39:40 AM11/30/22
to pypsa
Hi Everyone,

I just installed Pypsa in my new PC, and I faced this error in importing Pypsa.
----> 2 import pypsa ~\anaconda3\lib\site-packages\pypsa\__init__.py in <module> 8 """ 9 ---> 10 from pypsa import ( 11 components, 12 contingency, ~\anaconda3\lib\site-packages\pypsa\components.py in <module> 25 from scipy.sparse import csgraph 26 ---> 27 from pypsa.contingency import calculate_BODF, network_lpf_contingency, network_sclopf 28 from pypsa.descriptors import ( 29 Dict, ~\anaconda3\lib\site-packages\pypsa\contingency.py in <module> 27 from pypsa.descriptors import get_extendable_i 28 from pypsa.linopt import get_var, linexpr, set_conref, write_constraint ---> 29 from pypsa.opt import l_constraint 30 from pypsa.pf import _as_snapshots, calculate_PTDF 31 ~\anaconda3\lib\site-packages\pypsa\opt.py in <module> 28 29 from pyomo.core.base.constraint import _GeneralConstraintData ---> 30 from pyomo.core.expr.logical_expr import inequality 31 from pyomo.core.expr.numeric_expr import LinearExpression 32 from pyomo.environ import Constraint, Objective, Var, minimize
ImportError: cannot import name 'inequality' from 'pyomo.core.expr.logical_expr' (~\anaconda3\lib\site-packages\pyomo\core\expr\logical_expr.cp39-win_amd64.pyd)

Does anyone have a same problem and can let me know how I can fix it?

Best,
Amin

Johannes Hampp

unread,
Nov 30, 2022, 5:58:12 AM11/30/22
to Amin Shokri, pypsa
Hi Amin,

For a fix, see here / install the upstream PyPSA master:

https://github.com/PyPSA/PyPSA/pull/512

Best,
Johannes

Best regards,
Johannes Hampp (he/him)

Justus Liebig University Giessen (JLU)
Center for international Development and Environmental Research (ZEU)

mailto: johanne...@zeu.uni-giessen.de

Senckenbergstr. 3
DE-35392 Giessen
https://uni-giessen.de/zeu

Am 30/11/2022 um 11:39 schrieb Amin Shokri:
> Hi Everyone,
>
> I just installed Pypsa in my new PC, and I faced this error in importing
> Pypsa.
> ----> 2import pypsa ~\anaconda3\lib\site-packages\pypsa\__init__.py in
> <module> 8 """ 9 ---> 10from pypsa import ( 11 components, 12
> contingency, ~\anaconda3\lib\site-packages\pypsa\components.py in
> <module> 25 from scipy.sparse import csgraph 26 ---> 27from
> pypsa.contingency import calculate_BODF, network_lpf_contingency,
> network_sclopf 28 from pypsa.descriptors import ( 29 Dict,
> ~\anaconda3\lib\site-packages\pypsa\contingency.py in <module> 27 from
> pypsa.descriptors import get_extendable_i 28 from pypsa.linopt import
> get_var, linexpr, set_conref, write_constraint ---> 29from pypsa.opt
> import l_constraint 30 from pypsa.pf import _as_snapshots,
> calculate_PTDF 31 ~\anaconda3\lib\site-packages\pypsa\opt.py in <module>
> 28 29 from pyomo.core.base.constraint import _GeneralConstraintData --->
> 30from pyomo.core.expr.logical_expr import inequality 31 from
> pyomo.core.expr.numeric_expr import LinearExpression 32 from
> pyomo.environ import Constraint, Objective, Var, minimize
> ImportError: cannot import name 'inequality' from
> 'pyomo.core.expr.logical_expr'
> (~\anaconda3\lib\site-packages\pyomo\core\expr\logical_expr.cp39-win_amd64.pyd)
>
> Does anyone have a same problem and can let me know how I can fix it?
>
> Best,
> Amin
>
> --
> You received this message because you are subscribed to the Google
> Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pypsa+un...@googlegroups.com
> <mailto:pypsa+un...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pypsa/9b5d7423-69b1-4972-ba30-ca0873d2e50cn%40googlegroups.com <https://groups.google.com/d/msgid/pypsa/9b5d7423-69b1-4972-ba30-ca0873d2e50cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Amin Shokri

unread,
Nov 30, 2022, 7:05:51 AM11/30/22
to Johannes Hampp, pypsa
Hi Johannes,

Nice to hear from you. Thanks for sharing.
Now, it works.

Kind regards,
Amin

---------------------------

Dr. Amin Shokri Gazafroudi

Innovation & Project Manager | Senior Research Power System Engineer | Local Energy & Flexibility Markets Designer | Electricity Market & Power Grid Modeller


Reply all
Reply to author
Forward
0 new messages