gpt4 book ai didi

python-3.x - 无法在 databricks 上安装 pyomo 求解器 ipopt

转载 作者:行者123 更新时间:2023-12-02 06:06:24 35 4
gpt4 key购买 nike

使用以下命令在 databricks 上成功安装 pyomo -

pip install 'pyomo[optional]'

输出 -成功安装 algopy-0.5.7 casadi-3.5.5 dill-0.3.5.1 et-xmlfile-1.1.0 mpmath-1.2.1 networkx-2.8.5 numdifftools-0.9.40 openpyxl-3.0.10 pint-0.19.2 ply -3.11 pyomo-6.4.1 python-louvain-0.16 pyyaml-6.0 sympy-1.10.1 xlrd-2.0.1 z3-solver-4.10.2.0

尝试在 databricks 上安装其求解器 ipopt 时出现以下错误 -

Collecting ipopt
Downloading ipopt-1.0.3.tar.gz (42 kB)
|████████████████████████████████| 42 kB 1.1 MB/s eta 0:00:01
ERROR: Command errored out with exit status 1:
command: /databricks/python3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_97_jyim/ipopt_5ccc28f94eb5408181b160df9c422798/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_97_jyim/ipopt_5ccc28f94eb5408181b160df9c422798/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-zpxip7hb
cwd: /tmp/pip-install-_97_jyim/ipopt_5ccc28f94eb5408181b160df9c422798/
Complete output (13 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-_97_jyim/ipopt_5ccc28f94eb5408181b160df9c422798/setup.py", line 194, in <module>
ext_module_data = handle_ext_modules_general_os()
File "/tmp/pip-install-_97_jyim/ipopt_5ccc28f94eb5408181b160df9c422798/setup.py", line 173, in handle_ext_modules_general_os
**pkgconfig("ipopt"))
File "/tmp/pip-install-_97_jyim/ipopt_5ccc28f94eb5408181b160df9c422798/setup.py", line 100, in pkgconfig
output = sp.Popen(["pkg-config", "--libs", "--cflags"] + list(packages),
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pkg-config'
Downloading ipopt-0.1.3.zip (109 kB)
|████████████████████████████████| 109 kB 56.6 MB/s eta 0:00:01
Building wheels for collected packages: ipopt
Building wheel for ipopt (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /databricks/python3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_97_jyim/ipopt_8a62a84a8dcf4bc5a832cb6bb3713b52/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_97_jyim/ipopt_8a62a84a8dcf4bc5a832cb6bb3713b52/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-8pgnfwqa
cwd: /tmp/pip-install-_97_jyim/ipopt_8a62a84a8dcf4bc5a832cb6bb3713b52/
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/ipopt
copying ipopt/__init__.py -> build/lib.linux-x86_64-3.8/ipopt
running build_ext
skipping 'src/cyipopt.c' Cython extension (up-to-date)
building 'ipopt.cyipopt' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/amitibo/code/Ipopt-3.10.1/include/coin -I/databricks/python3/lib/python3.8/site-packages/numpy/core/include -I/databricks/python3/include -I/usr/include/python3.8 -c src/cyipopt.c -o build/temp.linux-x86_64-3.8/src/cyipopt.o
In file included from /databricks/python3/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1944,
from /databricks/python3/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /databricks/python3/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from src/cyipopt.c:237:
/databricks/python3/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with " \
| ^~~~~~~
src/cyipopt.c:239:10: fatal error: IpStdCInterface.h: No such file or directory
239 | #include "IpStdCInterface.h"
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

注意 - 在 azure 上运行 databricks。

最佳答案

尝试了几种不同的方法来安装 ipopt 后,在 Azure Databricks 笔记本中对我有用的是

cd /tmp
wget https://ampl.com/dl/open/ipopt/ipopt-linux64.zip
unzip ipopt-linux64.zip
chmod +x ipopt
mv ipopt /usr/local/bin

然后在创建求解器时将其指向ipopt的路径

solver = pe.SolverFactory('ipopt', executable='/usr/local/bin/ipopt')

即使 ipopt 在我的路径中,我也必须这样做。

我尝试按照此进行编译 https://coin-or.github.io/Ipopt/INSTALL.html但它永远不会将二进制文件放入 /usr/local/bin 中。另外通过 apt-get 或 pip 安装也不起作用

关于python-3.x - 无法在 databricks 上安装 pyomo 求解器 ipopt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73287866/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com