Pyomo / pyomo

An object-oriented algebraic modeling language in Python for structured optimization problems.
https://www.pyomo.org
Other
1.97k stars 505 forks source link

Import pyomo.environ fails #2598

Closed GianmarcoAndreana closed 1 year ago

GianmarcoAndreana commented 1 year ago

Python 3.11 OS: Windows Pyomo: 6.4.2

How to replicate issue: import pyomo.environ as pyo

Output of error message below


TypeError Traceback (most recent call last) Cell In [19], line 1 ----> 1 import pyomo.environ as pyo 2 import numpy as np 3 import pandas as pd

File c:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyomo\environ__init__.py:79 75 pkg = _sys.modules[pname] 76 pkg.load() ---> 79 _import_packages() 81 # 82 # Expose the symbols from pyomo.core 83 # 84 from pyomo.dataportal import DataPortal

File c:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyomo\environ__init__.py:61, in _import_packages() 59 pname = _package + '.plugins' 60 try: ---> 61 _do_import(pname) 62 except ImportError: 63 exctype, err, tb = _sys.exc_info() # BUG?

File c:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyomo\environ__init.py:16, in _do_import(pkg_name) 15 def _do_import(pkg_name): ... --> 471 state[key] = val 472 else: 473 state = dict(self.dict__)

TypeError: 'tuple' object does not support item assignment

jsiirola commented 1 year ago

This was resolved in main by #2596 and will be part of the next release (currently scheduled for Nov 21.