在窗口中从源代码构建统计信息模型时出错



当我尝试按照Windows的以下说明从源代码构建统计信息模型时:

http://www.statsmodels.org/dev/install.html

用:

python setup.py install

我收到以下错误:

fatal error C1047: The object or library file 'C:\Apps\Anaconda3\lib\site-packages\numpy\core\libnpymath.lib' was created with an older compiler than other objects; rebuild old objects and libraries LINK : fatal error LNK1257: code generation failed

有什么想法可以解决这个问题吗?我使用 Anaconda3 和 numpy 版本 1.13.1 和 Microsoft Visual Studio 2017。python setup.py install的完整输出如下:

Cythonizing sources
statsmodelsnonparametriclinbin.pyx has not changed
statsmodelsnonparametric_smoothers_lowess.pyx has not changed
statsmodelstsakalmanfkalman_loglike.pyx has not changed
statsmodelstsaregime_switching_hamilton_filter.pyx.in has not changed
statsmodelstsaregime_switching_kim_smoother.pyx.in has not changed
statsmodelstsastatespace_kalman_filter.pyx.in has not changed
statsmodelstsastatespace_kalman_smoother.pyx.in has not changed
statsmodelstsastatespace_representation.pyx.in has not changed
statsmodelstsastatespace_simulation_smoother.pyx.in has not changed
statsmodelstsastatespace_statespace.pyx.in has not changed
statsmodelstsastatespace_tools.pyx.in has not changed
statsmodelstsastatespace_filters_conventional.pyx.in has not changed
statsmodelstsastatespace_filters_inversions.pyx.in has not changed
statsmodelstsastatespace_filters_univariate.pyx.in has not changed
statsmodelstsastatespace_smoothers_alternative.pyx.in has not changed
statsmodelstsastatespace_smoothers_classical.pyx.in has not changed
statsmodelstsastatespace_smoothers_conventional.pyx.in has not changed
statsmodelstsastatespace_smoothers_univariate.pyx.in has not changed
running install
running bdist_egg
running egg_info
writing requirements to statsmodels.egg-inforequires.txt
writing statsmodels.egg-infoPKG-INFO
writing top-level names to statsmodels.egg-infotop_level.txt
writing dependency_links to statsmodels.egg-infodependency_links.txt
package init file 'statsmodelstsavector_ardata__init__.py' not found (or not a regular file)
reading manifest file 'statsmodels.egg-infoSOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.pxi' anywhere in distribution
warning: no previously-included files matching '*' found under directory 'dist'
warning: no previously-included files found matching 'docssourcegenerated*'
warning: no previously-included files matching '*' found under directory 'docsbuild'
warning: no previously-included files matching '*' found under directory 'docsbuildhtmlhelp'
warning: no files found matching 'statsmodelsstatsmodelsdoc.chm'
no previously-included directories found matching '*__pycache__'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.swp' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.bak' found anywhere in distribution
writing manifest file 'statsmodels.egg-infoSOURCES.txt'
installing library code to buildbdist.win-amd64egg
running install_lib
running build_py
copying statsmodelsversion.py -> buildlib.win-amd64-3.5statsmodels
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building 'statsmodels.tsa.statespace._statespace' extension
C:AppsMicrosoft Visual Studio2017CommunityVCToolsMSVC14.11.25503binHostX64x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Istatsmode
ls/src -IC:\Apps\Anaconda3\lib\site-packages\numpy\core\include -IC:AppsAnaconda3libsite-packagesnumpycoreinclude -IC:AppsAnaco
nda3include -IC:AppsAnaconda3include -I"C:AppsMicrosoft Visual Studio2017CommunityVCToolsMSVC14.11.25503Include" -I"C:AppsMicros
oft Visual Studio2017CommunityVCToolsMSVC14.11.25503ATLMFCInclude" -I"C:Program Files (x86)Windows Kits10include10.0.15063.0share
d" -I"C:Program Files (x86)Windows Kits10include10.0.15063.0um" -I"C:Program Files (x86)Windows Kits10include10.0.15063.0winrt" -I"
C:Program Files (x86)Windows Kits10include10.0.15063.0ucrt" /Tcstatsmodels/tsa/statespace/_statespace.c /Fobuildtemp.win-amd64-3.5Relea
sestatsmodels/tsa/statespace/_statespace.obj
C:AppsMicrosoft Visual Studio2017CommunityVCToolsMSVC14.11.25503binHostX64x64link.exe /nologo /INCREMENTAL:NO /LTCG /nodefaultlib:l
ibucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Apps\Anaconda3\lib\site-packages\numpy\core\lib /LIBPATH:C:Ap
psAnaconda3libs /LIBPATH:C:AppsAnaconda3PCbuildamd64 /LIBPATH:"C:AppsMicrosoft Visual Studio2017CommunityVCToolsMSVC14.11.25503L
ibx64" /LIBPATH:"C:AppsMicrosoft Visual Studio2017CommunityVCToolsMSVC14.11.25503ATLMFCLibx64" /LIBPATH:"C:Program Files (x86)Win
dows Kits10lib10.0.15063.0umx64" /LIBPATH:C:WINDOWSMicrosoft.NETFramework64v4.0.30319 /LIBPATH:"C:Program Files (x86)Windows Kits10
lib10.0.15063.0ucrtx64" npymath.lib /EXPORT:PyInit__statespace buildtemp.win-amd64-3.5Releasestatsmodels/tsa/statespace/_statespace.obj
/OUT:buildlib.win-amd64-3.5statsmodelstsastatespace_statespace.cp35-win_amd64.pyd /IMPLIB:buildtemp.win-amd64-3.5Releasestatsmodels/tsa
/statespace_statespace.cp35-win_amd64.lib
fatal error C1047: The object or library file 'C:\Apps\Anaconda3\lib\site-packages\numpy\core\libnpymath.lib' was created with an older
 compiler than other objects; rebuild old objects and libraries
LINK : fatal error LNK1257: code generation failed
error: Command "C:AppsMicrosoft Visual Studio2017CommunityVCToolsMSVC14.11.25503binHostX64x64link.exe /nologo /INCREMENTAL:NO /LTCG
 /nodefaultlib:libucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Apps\Anaconda3\lib\site-packages\numpy\core\li
b /LIBPATH:C:AppsAnaconda3libs /LIBPATH:C:AppsAnaconda3PCbuildamd64 /LIBPATH:"C:AppsMicrosoft Visual Studio2017CommunityVCToolsMS
VC14.11.25503Libx64" /LIBPATH:"C:AppsMicrosoft Visual Studio2017CommunityVCToolsMSVC14.11.25503ATLMFCLibx64" /LIBPATH:"C:Program
 Files (x86)Windows Kits10lib10.0.15063.0umx64" /LIBPATH:C:WINDOWSMicrosoft.NETFramework64v4.0.30319 /LIBPATH:"C:Program Files (x86)
Windows Kits10lib10.0.15063.0ucrtx64" npymath.lib /EXPORT:PyInit__statespace buildtemp.win-amd64-3.5Releasestatsmodels/tsa/statespace/
_statespace.obj /OUT:buildlib.win-amd64-3.5statsmodelstsastatespace_statespace.cp35-win_amd64.pyd /IMPLIB:buildtemp.win-amd64-3.5Release
statsmodels/tsa/statespace_statespace.cp35-win_amd64.lib" failed with exit status 1257

在statsmodels github中有一个大线程:

https://github.com/statsmodels/statsmodels/issues/4011#issuecomment-335490646

但简而言之,似乎通过将 Numpy 更新到 1.14.3 来解决问题

这是

Python 3.6.3 distutils问题 https://bugs.python.org/issue31340

解决方法:

"%VS140COMNTOOLS%....VCvcvarsall.bat" x64
set DISTUTILS_USE_SDK=1
python setup.py install

最新更新