python库SCS wheel构建失败



在尝试安装PyPortfolioOpt模块时,由于Ecos和scs模块无法构建,因此失败。我通过获得visual studio构建工具修复了eco的问题,但scs仍然失败。我正在使用python 3.8的conda环境,我尝试了conda安装,但它无法在默认通道中找到包。下面是错误信息:

C:UsersFranklin Joe>pip install scs
Collecting scs
Using cached scs-2.1.2.tar.gz (3.5 MB)
Requirement already satisfied: numpy>=1.7 in c:programdataanaconda3libsite-packages (from scs) (1.19.2)
Requirement already satisfied: scipy>=0.13.2 in c:programdataanaconda3libsite-packages (from scs) (1.5.2)
Building wheels for collected packages: scs
Building wheel for scs (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:ProgramDataAnaconda3python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Franklin Joe\AppData\Local\Temp\pip-install-ifm96i5v\scs\setup.py'"'"'; __file__='"'"'C:\Users\Franklin Joe\AppData\Local\Temp\pip-install-ifm96i5v\scs\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersFranklin JoeAppDataLocalTemppip-wheel-z7f66io1'
cwd: C:UsersFranklin JoeAppDataLocalTemppip-install-ifm96i5vscs
Complete output (79 lines):
Namespace(blas64=False, extraverbose=False, float32=False, gpu=False, int32=False, scs=False)
running bdist_wheel
running build
running build_py
creating build
creating buildlib.win-amd64-3.8
creating buildlib.win-amd64-3.8scs
copying src__init__.py -> buildlib.win-amd64-3.8scs
running build_ext
blas_mkl_info:
libraries = ['mkl_rt']
library_dirs = ['C:/ProgramData/Anaconda3\Library\lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['C:/ProgramData/Anaconda3\Library\include']
blas_opt_info:
libraries = ['mkl_rt']
library_dirs = ['C:/ProgramData/Anaconda3\Library\lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['C:/ProgramData/Anaconda3\Library\include']
lapack_mkl_info:
libraries = ['mkl_rt']
library_dirs = ['C:/ProgramData/Anaconda3\Library\lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['C:/ProgramData/Anaconda3\Library\include']
lapack_opt_info:
libraries = ['mkl_rt']
library_dirs = ['C:/ProgramData/Anaconda3\Library\lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['C:/ProgramData/Anaconda3\Library\include']
Could not locate executable g77
Could not locate executable f77
Could not locate executable ifort
Could not locate executable ifl
Could not locate executable f90
Could not locate executable DF
Could not locate executable efl
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable g95
Could not locate executable efort
Could not locate executable efc
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1914: UserWarning:
Optimized (vendor) Blas libraries are not found.
Falls back to netlib Blas library which has worse performance.
A better performance should be easily gained by switching
Blas library.
if self._calc_info(blas):
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1914: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
if self._calc_info(blas):
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1914: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
if self._calc_info(blas):
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
cl : Command line warning D9002 : ignoring unknown option '-O3'
scsmodule.c
c:programdataanaconda3includepyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: Command "C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYTHON -DCTRLC=1 -DDLONG=1 -DCOPYAMATRIX -Iscs/include -Iscs/linsys -Iscs/linsys/cpu/direct/ -Iscs/linsys/external/amd -Iscs/linsys/external/dqlql -IC:ProgramDataAnaconda3libsite-packagesnumpycoreinclude -IC:ProgramDataAnaconda3include -IC:ProgramDataAnaconda3include -IC:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023include /Tcsrc/scsmodule.c /Fobuildtemp.win-amd64-3.8Releasesrc/scsmodule.obj -O3" failed with exit status 2
{}
{}
----------------------------------------
ERROR: Failed building wheel for scs
Running setup.py clean for scs
Failed to build scs
Installing collected packages: scs
Running setup.py install for scs ... error
ERROR: Command errored out with exit status 1:
command: 'C:ProgramDataAnaconda3python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Franklin Joe\AppData\Local\Temp\pip-install-ifm96i5v\scs\setup.py'"'"'; __file__='"'"'C:\Users\Franklin Joe\AppData\Local\Temp\pip-install-ifm96i5v\scs\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersFranklin JoeAppDataLocalTemppip-record-tqjx263cinstall-record.txt' --single-version-externally-managed --compile --install-headers 'C:ProgramDataAnaconda3Includescs'
cwd: C:UsersFranklin JoeAppDataLocalTemppip-install-ifm96i5vscs
Complete output (79 lines):
Namespace(blas64=False, extraverbose=False, float32=False, gpu=False, int32=False, scs=False)
running install
running build
running build_py
creating build
creating buildlib.win-amd64-3.8
creating buildlib.win-amd64-3.8scs
copying src__init__.py -> buildlib.win-amd64-3.8scs
running build_ext
blas_mkl_info:
libraries = ['mkl_rt']
library_dirs = ['C:/ProgramData/Anaconda3\Library\lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['C:/ProgramData/Anaconda3\Library\include']
blas_opt_info:
libraries = ['mkl_rt']
library_dirs = ['C:/ProgramData/Anaconda3\Library\lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['C:/ProgramData/Anaconda3\Library\include']
lapack_mkl_info:
libraries = ['mkl_rt']
library_dirs = ['C:/ProgramData/Anaconda3\Library\lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['C:/ProgramData/Anaconda3\Library\include']
lapack_opt_info:
libraries = ['mkl_rt']
library_dirs = ['C:/ProgramData/Anaconda3\Library\lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['C:/ProgramData/Anaconda3\Library\include']
Could not locate executable g77
Could not locate executable f77
Could not locate executable ifort
Could not locate executable ifl
Could not locate executable f90
Could not locate executable DF
Could not locate executable efl
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable g95
Could not locate executable efort
Could not locate executable efc
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1914: UserWarning:
Optimized (vendor) Blas libraries are not found.
Falls back to netlib Blas library which has worse performance.
A better performance should be easily gained by switching
Blas library.
if self._calc_info(blas):
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1914: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
if self._calc_info(blas):
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1914: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
if self._calc_info(blas):
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
C:ProgramDataAnaconda3libsite-packagesnumpydistutilssystem_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
cl : Command line warning D9002 : ignoring unknown option '-O3'
scsmodule.c
c:programdataanaconda3includepyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: Command "C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYTHON -DCTRLC=1 -DDLONG=1 -DCOPYAMATRIX -Iscs/include -Iscs/linsys -Iscs/linsys/cpu/direct/ -Iscs/linsys/external/amd -Iscs/linsys/external/dqlql -IC:ProgramDataAnaconda3libsite-packagesnumpycoreinclude -IC:ProgramDataAnaconda3include -IC:ProgramDataAnaconda3include -IC:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.16.27023include /Tcsrc/scsmodule.c /Fobuildtemp.win-amd64-3.8Releasesrc/scsmodule.obj -O3" failed with exit status 2
{}
{}
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:ProgramDataAnaconda3python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Franklin Joe\AppData\Local\Temp\pip-install-ifm96i5v\scs\setup.py'"'"'; __file__='"'"'C:\Users\Franklin Joe\AppData\Local\Temp\pip-install-ifm96i5v\scs\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersFranklin JoeAppDataLocalTemppip-record-tqjx263cinstall-record.txt' --single-version-externally-managed --compile --install-headers 'C:ProgramDataAnaconda3Includescs' Check the logs for full command output.

我在conda环境中遇到过完全相同的问题。我的python版本是3.7.9这似乎与conda环境有关(但不确定)

我已经尝试使用conda来安装软件包,

conda install -c anaconda ecos
conda install -c conda-forge scs

这解决了我的问题。

最新更新