calliope-project / calliope

A multi-scale energy systems modelling framework

Home Page:https://www.callio.pe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"ImportError: pyutilib.enum has been removed" When Running Pre-Built Model

zoltanmaric opened this issue · comments

Problem description

I'm trying to run ./continental/example-model.yaml from the prebuilt models package on Ubuntu 20.04.4 LTS, but it seems it uses a version of pyomo that calls the removed module pyutilib.enum.

Steps to reproduce the problem

cd pre-built-euro-calliope-v1.0/
conda env create -f environment.yaml
conda activate euro-calliope
calliope run ./continental/example-model.yaml

Output:

Traceback (most recent call last):
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/bin/calliope", line 6, in <module>
    from calliope.cli import cli
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/calliope/__init__.py", line 3, in <module>
    from calliope import examples, exceptions
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/calliope/examples.py", line 14, in <module>
    from calliope.core.model import Model
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/calliope/core/__init__.py", line 1, in <module>
    from calliope.core.model import Model, read_netcdf
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/calliope/core/model.py", line 33, in <module>
    from calliope.backend.run import run as run_backend
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/calliope/backend/run.py", line 14, in <module>
    from calliope.backend.pyomo import model as run_pyomo
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/calliope/backend/pyomo/model.py", line 15, in <module>
    import pyomo.core as po  # pylint: disable=import-error
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/pyomo/core/__init__.py", line 11, in <module>
    from pyomo.core.expr import *
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/pyomo/core/expr/__init__.py", line 36, in <module>
    from .calculus.derivatives import differentiate
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/pyomo/core/expr/calculus/derivatives.py", line 3, in <module>
    from pyutilib.enum import Enum
  File "/home/zoltan/mambaforge/envs/euro-calliope-prebuilt/lib/python3.7/site-packages/pyutilib/enum/__init__.py", line 18, in <module>
    package) that supersedes this library.""")
ImportError: pyutilib.enum has been removed.

Python 3 now has an enum implementation in the standard library (also
available for older Python versions as the third-party enum34 PyPI
package) that supersedes this library.

Calliope version

0.6.5 - as defined in the environment.yaml of the pre-built package.
The pyomo version used is 5.6.8. Using 5.6.9 resulted in the same error, while 5.7 results in conflicting packages during environment creation.

My apologies, this was in fact an issue for the euro-calliope project. I posted the issue there too (link), so I'll close this one.