Skip to content

Commit 239d62c

Browse files
committed
Allow later versions of Pyomo and Python
Previously Switch 2.0.9 required Pyomo <= 6.7.2, which is incompatible with numpy >= 2.0, which would automatically be installed as part of the pandas dependency after June 2024. This release updates metadata to allow later versions of Pyomo that will work with numpy > 2.0. Note that it is still possible for users to create a non-working environment by installing Pyomo < 6.8.0 with numpy >= 2.0, but we assume most installations will either use old versions of Pyomo with old versions of Numpy or new versions of Pyomo with new versions of Numpy.
1 parent 6c81834 commit 239d62c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
with open(version_path) as f:
2222
exec(f.read(), version)
2323
__version__ = version["__version__"]
24+
# for metadata patch
25+
__version__ += ".post0"
2426

2527

2628
def read(*rnames):
@@ -78,14 +80,14 @@ def read(*rnames):
7880
# Note: testfixtures requires a separate mock installation if running with
7981
# Python 3.7.0 or 3.7.1, so we require a higher version to avoid this. (Newer
8082
# versions of Pyomo need 3.8+ anyway.)
81-
python_requires=">=3.7.2, <3.13.0a0",
83+
python_requires=">=3.7.2, <3.14.0a0",
8284
install_requires=[
8385
# In principle, we could accept Pyomo 5.6.9, but it tends to install
8486
# a non-compatible version of pyutilib (needs 5.8.0 but accepts 6.0.0
8587
# and then breaks). On the other hand, Pyomo 5.7 requires pyutilib 6.0.0
8688
# and Pyomo 6.0 doesn't require pyutilib at all. So we now use Pyomo 6.0+
8789
# and skip pyutilib.
88-
"Pyomo >=6.0.0, <=6.7.2",
90+
"Pyomo >=6.0.0, <=6.9.1",
8991
# pint is needed by Pyomo 6.4.1, 6.7.1 and probably others (but not
9092
# 6.0.0) when running our tests. But it isn't listed as a Pyomo
9193
# dependency, so we add it explicitly. (Still true as of Pyomo 6.7.1).
@@ -94,6 +96,12 @@ def read(*rnames):
9496
"testfixtures",
9597
# used for input upgrades and some reporting
9698
"pandas",
99+
# provides pkg_resources used by upgrade scripts
100+
"setuptools",
101+
# Note: if users pick pyomo <6.8.0 and numpy >=2.0 (brought
102+
# in by pandas), pyomo will crash. We could avoid this by requiring
103+
# numpy <2.0, but instead we assume they will use a newer version
104+
# of pyomo if they are using a newer version of numpy.
97105
],
98106
extras_require={
99107
# packages used for advanced demand response, progressive hedging

0 commit comments

Comments
 (0)