无法安装OSQP软件包

时间:2019-11-19 18:17:19

标签: python pip package

我正在尝试安装CVXPY软件包,该软件包具有OSQP作为依存关系,但我在安装它时惨败。这是日志:

Microsoft Windows [Version 10.0.18362.476]
(c) 2019 Microsoft Corporation. Alle Rechte vorbehalten.

C:\WINDOWS\system32>pip install osqp
Collecting osqp
  Using cached https://files.pythonhosted.org/packages/ba/17/49790ce2ce7a6b95cd250642ebc68bd723ddefdd052ee8dcc1e0dcf4ffca/osqp-0.6.1.tar.gz
Requirement already satisfied: numpy>=1.7 in c:\users\felix\appdata\local\programs\python\python38-32\lib\site-packages (from osqp) (1.17.4)
Requirement already satisfied: scipy>=0.13.2 in c:\users\felix\appdata\local\programs\python\python38-32\lib\site-packages (from osqp) (1.3.2)
Requirement already satisfied: future in c:\users\felix\appdata\local\programs\python\python38-32\lib\site-packages (from osqp) (0.18.2)
Installing collected packages: osqp
  Running setup.py install for osqp ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\felix\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\felix\\AppData\\Local\\Temp\\pip-install-3lddfze1\\osqp\\setup.py'"'"'; __file__='"'"'C:\\Users\\felix\\AppData\\Local\\Temp\\pip-install-3lddfze1\\osqp\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\felix\AppData\Local\Temp\pip-record-0cy159dw\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\felix\AppData\Local\Temp\pip-install-3lddfze1\osqp\
    Complete output (93 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.8
    creating build\lib.win32-3.8\osqp
    copying module\interface.py -> build\lib.win32-3.8\osqp
    copying module\utils.py -> build\lib.win32-3.8\osqp
    copying module\__init__.py -> build\lib.win32-3.8\osqp
    creating build\lib.win32-3.8\osqp\codegen
    copying module\codegen\code_generator.py -> build\lib.win32-3.8\osqp\codegen
    copying module\codegen\utils.py -> build\lib.win32-3.8\osqp\codegen
    copying module\codegen\__init__.py -> build\lib.win32-3.8\osqp\codegen
    creating build\lib.win32-3.8\osqp\tests
    copying module\tests\basic_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\codegen_matrices_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\codegen_vectors_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\dual_infeasibility_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\feasibility_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\mkl_pardiso_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\non_convex_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\polishing_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\primal_infeasibility_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\unconstrained_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\update_matrices_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\warm_start_test.py -> build\lib.win32-3.8\osqp\tests
    copying module\tests\__init__.py -> build\lib.win32-3.8\osqp\tests
    creating build\lib.win32-3.8\osqppurepy
    copying modulepurepy\interface.py -> build\lib.win32-3.8\osqppurepy
    copying modulepurepy\_osqp.py -> build\lib.win32-3.8\osqppurepy
    copying modulepurepy\__init__.py -> build\lib.win32-3.8\osqppurepy
    running egg_info
    writing osqp.egg-info\PKG-INFO
    writing dependency_links to osqp.egg-info\dependency_links.txt
    writing requirements to osqp.egg-info\requires.txt
    writing top-level names to osqp.egg-info\top_level.txt
    reading manifest file 'osqp.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'osqp.egg-info\SOURCES.txt'
    creating build\lib.win32-3.8\osqp\codegen\files_to_generate
    copying module\codegen\files_to_generate\CMakeLists.txt -> build\lib.win32-3.8\osqp\codegen\files_to_generate
    copying module\codegen\files_to_generate\emosqpmodule.c -> build\lib.win32-3.8\osqp\codegen\files_to_generate
    copying module\codegen\files_to_generate\example.c -> build\lib.win32-3.8\osqp\codegen\files_to_generate
    copying module\codegen\files_to_generate\setup.py -> build\lib.win32-3.8\osqp\codegen\files_to_generate
    creating build\lib.win32-3.8\osqp\codegen\sources
    creating build\lib.win32-3.8\osqp\codegen\sources\configure
    copying module\codegen\sources\configure\osqp_configure.h.in -> build\lib.win32-3.8\osqp\codegen\sources\configure
    copying module\codegen\sources\configure\qdldl_types.h.in -> build\lib.win32-3.8\osqp\codegen\sources\configure
    creating build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\CMakeLists.txt -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\auxil.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\constants.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\error.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\glob_opts.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\kkt.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\lin_alg.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\osqp.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\proj.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\qdldl.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\qdldl_interface.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\scaling.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\types.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    copying module\codegen\sources\include\util.h -> build\lib.win32-3.8\osqp\codegen\sources\include
    creating build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\CMakeLists.txt -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\auxil.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\error.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\kkt.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\lin_alg.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\osqp.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\proj.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\qdldl.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\qdldl_interface.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\scaling.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    copying module\codegen\sources\src\util.c -> build\lib.win32-3.8\osqp\codegen\sources\src
    running build_ext
    -- Selecting Windows SDK version  to target Windows 10.0.18362.
    CMake Error at CMakeLists.txt:5 (project):
      Failed to run MSBuild command:

        MSBuild.exe

      to get the value of VCTargetsPath:

        Das System kann die angegebene Datei nicht finden



    -- Configuring incomplete, errors occurred!
    See also "C:/Users/felix/AppData/Local/Temp/pip-install-3lddfze1/osqp/osqp_sources/build/CMakeFiles/CMakeOutput.log".
    Das System kann die angegebene Datei nicht finden
    CMake Error: Generator: execution of make failed. Make command was: MSBuild.exe osqpstatic.vcxproj /p:Configuration=Release /p:Platform=Win32 /p:VisualStudioVersion=14.0 /v:m &&
    error: [Errno 2] No such file or directory: 'osqp_sources\\build\\out\\Release\\osqp.lib'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\felix\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\felix\\AppData\\Local\\Temp\\pip-install-3lddfze1\\osqp\\setup.py'"'"'; __file__='"'"'C:\\Users\\felix\\AppData\\Local\\Temp\\pip-install-3lddfze1\\osqp\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\felix\AppData\Local\Temp\pip-record-0cy159dw\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

似乎MSBuildTools有问题。我已经按照CVXPY网页上的说明安装了构建工具:https://drive.google.com/file/d/0B4GsMXCRaSSIOWpYQkstajlYZ0tPVkNQSElmTWh1dXFaYkJr/view

那没有用。然后我发现了这个问题(Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualst udio.com/visual-cpp-build-tools),并相应地修改了构建工具的安装,但仍然无法正常工作。我没有屏幕截图中Web和云下的python开发,但是无论如何这应该是可选的。

能请你帮我吗?

P.S。:Das System kann die angegebene Datei nicht finden大致翻译为The system can't find the specified file

编辑:这是构建工具的安装,以防万一:

enter image description here

2 个答案:

答案 0 :(得分:0)

我面临着同样的问题。从链接https://www.lfd.uci.edu/~gohlke/pythonlibs/#osqp(由phd发布),下载osqp的相应版本,并使用(例如)安装它:

pip install osqp-0.6.1-cp38-cp38-win_amd64.whl

然后,您应该可以简单地使用{p> 1来安装cvxpy

pip install cvxpy

答案 1 :(得分:0)

我是开发商之一。适用于python 3.8的OSQP pip wheel现在为online。它应该可以解决您的问题。