macOS 11.7下HiGHS、highspy与Pyomo集成问题求助
HiGHS求解器配合Pyomo在macOS 11.7上运行失败问题
在搭载macOS 11.7的旧款Mac上,此前成功用HiGHS求解器配合Python/Pyomo运行多个模型,目前无法正常工作。
已执行操作
- 按官方源码编译指南安装HiGHS v1.5.3,命令行下可正常处理.mps模型并输出结果
- 从PyPI安装highspy v1.5.3后,导入时崩溃,错误信息如下:
~ % pip3 show highspy Name: highspy Version: 1.5.3 Summary: Python interface to HiGHS Home-page: https://github.com/ergo-code/highs Author: Author-email: License: MIT Location: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages Requires: Required-by: ~ % python3 Python 3.11.0 (v3.11.0:deaf509e8f, Oct 24 2022, 14:43:23) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import highspy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/highspy/__init__.py", line 1, in <module> from .highs import ( File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/highspy/highs.py", line 1, in <module> from .highs_bindings import ( ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/highspy/highs_bindings.cpython-311-darwin.so, 2): Symbol not found: __ZN5Highs10clearModelEv Referenced from: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/highspy/highs_bindings.cpython-311-darwin.so Expected in: flat namespace in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/highspy/highs_bindings.cpython-311-darwin.so >>>
尝试的排查步骤及结果
- 猜测是Python 3.11兼容问题,切换到Python 3.10虚拟环境测试,错误完全相同
- 测试Pyomo模型:
- 带
import highspy的模型触发上述导入错误,无法运行 - 不带导入的模型报错:
- 带
pyomo.common.errors.ApplicationError: Solver <class 'pyomo.contrib.appsi.base.SolverFactoryClass.register.<locals>.decorator.<locals>.LegacySolver'> is not available (NotFound).
内容的提问来源于stack exchange,提问作者AirSquid
相关产品推荐
相关产品推荐

