我正在尝试安装GLPK求解器以在Python中使用。在CVXPY网站上的instructions之后,我尝试了pip install cvxpy[glpk]
,但收到以下错误消息:
cvxpy 1.0.21没有提供额外的“ glpk”
这是怎么回事?如何为cvxpy安装GLPK_MI求解器?
答案 0 :(得分:0)
cvxpy
1.0.21 was released 2019年3月8日,即26天前。 glpk
额外was added将于2019年3月10日(24天前)
额外的内容在git仓库中可用,但尚未发布到PyPI。您可以尝试从git repo安装它:
pip install 'git+https://github.com/cvxgrp/cvxpy.git#egg=cvxpy[glpk]'
为我工作:
$ pip install 'git+https://github.com/cvxgrp/cvxpy.git#egg=cvxpy[glpk]'
Collecting cvxpy[glpk] from git+https://github.com/cvxgrp/cvxpy.git#egg=cvxpy[glpk]
Cloning https://github.com/cvxgrp/cvxpy.git to /tmp/pip-install-u_k0fsp4/cvxpy
Collecting osqp>=0.4.1 (from cvxpy[glpk])
Downloading https://files.pythonhosted.org/packages/ac/34/1edd8da520354be1e280fb62afe1c26447b172bbce2c56934d57c0bfa23f/osqp-0.5.0-cp35-cp35m-manylinux1_i686.whl (143kB)
100% |################################| 153kB 2.6MB/s
Collecting ecos>=2 (from cvxpy[glpk])
Downloading https://files.pythonhosted.org/packages/6e/14/fa2c1c398a4a85465f2817e8f6c9220bb395d058a32583e903dbe706aaea/ecos-2.0.7.post1-cp35-cp35m-manylinux1_i686.whl (134kB)
100% |################################| 143kB 11.9MB/s
Collecting scs>=1.1.3 (from cvxpy[glpk])
Downloading https://files.pythonhosted.org/packages/07/a7/0b19c8f9476a4762d296c6c5fa860f2fe580a4f579fa53aaa8515f4ca217/scs-2.1.0.tar.gz (154kB)
100% |################################| 163kB 11.1MB/s
Collecting multiprocess (from cvxpy[glpk])
Downloading https://files.pythonhosted.org/packages/31/60/6d74caa02b54ca43092e745640c7d98f367f07160441682a01602ce00bc5/multiprocess-0.70.7.tar.gz (1.4MB)
100% |################################| 1.4MB 6.4MB/s
Collecting fastcache (from cvxpy[glpk])
Downloading https://files.pythonhosted.org/packages/fb/98/93f2d36738868e8dd5a8dbfc918169b24658f63e5fa041fe000c22ae4f8b/fastcache-1.0.2.tar.gz
Collecting six (from cvxpy[glpk])
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting numpy>=1.15 (from cvxpy[glpk])
Using cached https://files.pythonhosted.org/packages/45/04/7a738e489a25a9638520a43a0cbfcc4be3ed056266e3110a330a905b36b5/numpy-1.16.2-cp35-cp35m-manylinux1_i686.whl
Collecting scipy>=1.1.0 (from cvxpy[glpk])
Downloading https://files.pythonhosted.org/packages/19/7b/fdd034bbd1c266b05bc5c38bc91e6733c0e19bc9d3630fd32d869998b6e3/scipy-1.2.1-cp35-cp35m-manylinux1_i686.whl (21.3MB)
100% |################################| 21.3MB 374kB/s
Collecting cvxopt>=1.2.0 (from cvxpy[glpk])
Downloading https://files.pythonhosted.org/packages/aa/a7/fe5b9b83caac402ecf58fe4420a94b16e8e530c05138343fc1977a5c1c58/cvxopt-1.2.3-cp35-cp35m-manylinux1_i686.whl (8.0MB)
100% |################################| 8.0MB 2.0MB/s
Collecting future (from osqp>=0.4.1->cvxpy[glpk])
Collecting dill>=0.2.9 (from multiprocess->cvxpy[glpk])
Downloading https://files.pythonhosted.org/packages/fe/42/bfe2e0857bc284cbe6a011d93f2a9ad58a22cb894461b199ae72cfef0f29/dill-0.2.9.tar.gz (150kB)
100% |################################| 153kB 3.1MB/s
Building wheels for collected packages: cvxpy, scs, multiprocess, fastcache, dill
Building wheel for cvxpy (setup.py) ... done
Stored in directory: /tmp/pip-ephem-wheel-cache-10tza7d7/wheels/0e/7c/42/bc3294fba335fafe64e2ae05be0ce1b671bbe20244056cecae
Building wheel for scs (setup.py) ... done
Stored in directory: /home/phd/.cache/pip/wheels/94/e2/a6/64db723051c54017c248ea5a26e7f1459c0242d735a496dd55
Building wheel for multiprocess (setup.py) ... done
Stored in directory: /home/phd/.cache/pip/wheels/3a/ed/51/77c833462c3e757ce50c4b2b68bdf53f5d1745542fe567d740
Building wheel for fastcache (setup.py) ... done
Stored in directory: /home/phd/.cache/pip/wheels/b7/90/c0/da92ac52d188d9ebca577044e89a14d0e6ff333c1bcd1ebc14
Building wheel for dill (setup.py) ... done
Stored in directory: /home/phd/.cache/pip/wheels/5b/d7/0f/e58eae695403de585269f4e4a94e0cd6ca60ec0c202936fa4a
Successfully built cvxpy scs multiprocess fastcache dill
Installing collected packages: future, numpy, scipy, osqp, ecos, scs, dill, multiprocess, fastcache, six, cvxopt, cvxpy
Successfully installed cvxopt-1.2.3 cvxpy-1.0.21 dill-0.2.9 ecos-2.0.7.post1 fastcache-1.0.2 future-0.17.1 multiprocess-0.70.7 numpy-1.16.2 osqp-0.5.0 scipy-1.2.1 scs-2.1.0 six-1.12.0