这是我在装YOLOX的环境:yolox和 pycocotools 编译时出的问题,具体解决过程如下:
在windows上安装好pytorch环境后,跑YOLOX出现了一些问题,主要是yolox的编译问题和pycocotools的编译不成功问题,摸索了一下,暂时记录一下过程。如果有好的解决方法,也在此请读者予以告知,不甚感激。
(pytorch) D:\code\pytorch\YOLOX\cocoapi-master\PythonAPI>python setup.py install
running install
running bdist_egg
running egg_info
writing pycocotools.egg-info\PKG-INFO
writing dependency_links to pycocotools.egg-info\dependency_links.txt
writing requirements to pycocotools.egg-info\requires.txt
writing top-level names to pycocotools.egg-info\top_level.txt
reading manifest file 'pycocotools.egg-info\SOURCES.txt'
writing manifest file 'pycocotools.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
skipping 'pycocotools\_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include -I../common -ID:\soft\anaconda\envs\pytorch\include -ID:\soft\anaconda\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.7\Release\../common/maskApi.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
maskApi.c
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include -I../common -ID:\soft\anaconda\envs\pytorch\include -ID:\soft\anaconda\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpycocotools\_mask.c /Fobuild\temp.win-amd64-3.7\Release\pycocotools\_mask.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
_mask.c
d:\soft\anaconda\envs\pytorch\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
这时报错:
cl : Command line warning D9002 : ignoring unknown option ‘-std=c99’
_mask.c
d:\soft\anaconda\envs\pytorch\include\pyconfig.h(203): fatal error C1083: Cannot open include file: ‘basetsd.h’: No such file or directory
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe’ failed with exit status 2
百度搜索后有说是win10 SDK的问题,于是我安装了Windows 10 SDK,重新编译pycocotools,发现错误变了
我原想过能不能直接下载缺少的文件,直接放在缺失位置,看看是什么情况,是否可以解决
根据搜索的解决方法,我先安装了Windows 10 SDK,编译问题如下:
(pytorch) D:\code\pytorch\YOLOX\cocoapi-master\PythonAPI>python setup.py install
running install
running bdist_egg
running egg_info
writing pycocotools.egg-info\PKG-INFO
writing dependency_links to pycocotools.egg-info\dependency_links.txt
writing requirements to pycocotools.egg-info\requires.txt
writing top-level names to pycocotools.egg-info\top_level.txt
reading manifest file 'pycocotools.egg-info\SOURCES.txt'
writing manifest file 'pycocotools.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
skipping 'pycocotools\_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include -I../common -ID:\soft\anaconda\envs\pytorch\include -ID:\soft\anaconda\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.7\Release\../common/maskApi.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
maskApi.c
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include -I../common -ID:\soft\anaconda\envs\pytorch\include -ID:\soft\anaconda\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt" /Tcpycocotools\_mask.c /Fobuild\temp.win-amd64-3.7\Release\pycocotools\_mask.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
_mask.c
d:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
pycocotools\_mask.c(3254): warning C4244: '=': conversion from 'Py_ssize_t' to 'siz', possible loss of data
pycocotools\_mask.c(3658): warning C4244: 'function': conversion from 'npy_intp' to 'siz', possible loss of data
pycocotools\_mask.c(6620): warning C4244: '=': conversion from 'npy_intp' to 'siz', possible loss of data
pycocotools\_mask.c(7366): warning C4244: '=': conversion from 'Py_ssize_t' to 'siz', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\soft\anaconda\envs\pytorch\libs /LIBPATH:D:\soft\anaconda\envs\pytorch\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\um\x64" /EXPORT:PyInit__mask build\temp.win-amd64-3.7\Release\../common/maskApi.obj build\temp.win-amd64-3.7\Release\pycocotools\_mask.obj /OUT:build\lib.win-amd64-3.7\pycocotools\_mask.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.lib
_mask.obj : warning LNK4197: export 'PyInit__mask' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.exp
Generating code
Finished generating code
LINK : fatal error LNK1158: cannot run 'rc.exe'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158
(pytorch) D:\code\pytorch\YOLOX\cocoapi-master\PythonAPI>
搜索后说添加windows kit的环境变量,照做后再次编译,结果如下
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
_mask.c
d:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
pycocotools\_mask.c(3254): warning C4244: '=': conversion from 'Py_ssize_t' to 'siz', possible loss of data
pycocotools\_mask.c(3658): warning C4244: 'function': conversion from 'npy_intp' to 'siz', possible loss of data
pycocotools\_mask.c(6620): warning C4244: '=': conversion from 'npy_intp' to 'siz', possible loss of data
pycocotools\_mask.c(7366): warning C4244: '=': conversion from 'Py_ssize_t' to 'siz', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\soft\anaconda\envs\pytorch\libs /LIBPATH:D:\soft\anaconda\envs\pytorch\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\um\x64" /EXPORT:PyInit__mask build\temp.win-amd64-3.7\Release\../common/maskApi.obj build\temp.win-amd64-3.7\Release\pycocotools\_mask.obj /OUT:build\lib.win-amd64-3.7\pycocotools\_mask.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.lib
_mask.obj : warning LNK4197: export 'PyInit__mask' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.exp
Generating code
Finished generating code
LINK : fatal error LNK1158: cannot run 'rc.exe'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158
看来对我的没有作用,又踩了个坑
根据最新的报错,我又找了篇博客看看,建议是从C:\Program Files (x86)\Windows Kits\8.1\bin\x86 拷贝rc.exe 和 rcdll.dll到如下位置
我的是C:\Program Files (x86)\Windows Kits\10\bin\x86 ,但是在目录下并没有找到这两个文件,我于是搜索一下找到了,对应x86,拷贝出来,直接放进去了,再次编译pycocotools,结果如下:
(pytorch) D:\code\pytorch\YOLOX\cocoapi-master\PythonAPI>python setup.py install
running install
running bdist_egg
running egg_info
writing pycocotools.egg-info\PKG-INFO
writing dependency_links to pycocotools.egg-info\dependency_links.txt
writing requirements to pycocotools.egg-info\requires.txt
writing top-level names to pycocotools.egg-info\top_level.txt
reading manifest file 'pycocotools.egg-info\SOURCES.txt'
writing manifest file 'pycocotools.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
skipping 'pycocotools\_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include -I../common -ID:\soft\anaconda\envs\pytorch\include -ID:\soft\anaconda\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.7\Release\../common/maskApi.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
maskApi.c
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include -I../common -ID:\soft\anaconda\envs\pytorch\include -ID:\soft\anaconda\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt" /Tcpycocotools\_mask.c /Fobuild\temp.win-amd64-3.7\Release\pycocotools\_mask.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
_mask.c
d:\soft\anaconda\envs\pytorch\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
pycocotools\_mask.c(3254): warning C4244: '=': conversion from 'Py_ssize_t' to 'siz', possible loss of data
pycocotools\_mask.c(3658): warning C4244: 'function': conversion from 'npy_intp' to 'siz', possible loss of data
pycocotools\_mask.c(6620): warning C4244: '=': conversion from 'npy_intp' to 'siz', possible loss of data
pycocotools\_mask.c(7366): warning C4244: '=': conversion from 'Py_ssize_t' to 'siz', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\soft\anaconda\envs\pytorch\libs /LIBPATH:D:\soft\anaconda\envs\pytorch\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\um\x64" /EXPORT:PyInit__mask build\temp.win-amd64-3.7\Release\../common/maskApi.obj build\temp.win-amd64-3.7\Release\pycocotools\_mask.obj /OUT:build\lib.win-amd64-3.7\pycocotools\_mask.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.lib
_mask.obj : warning LNK4197: export 'PyInit__mask' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\../common\_mask.cp37-win_amd64.exp
Generating code
Finished generating code
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\pycocotools
copying build\lib.win-amd64-3.7\pycocotools\coco.py -> build\bdist.win-amd64\egg\pycocotools
copying build\lib.win-amd64-3.7\pycocotools\cocoeval.py -> build\bdist.win-amd64\egg\pycocotools
copying build\lib.win-amd64-3.7\pycocotools\mask.py -> build\bdist.win-amd64\egg\pycocotools
copying build\lib.win-amd64-3.7\pycocotools\_mask.cp37-win_amd64.pyd -> build\bdist.win-amd64\egg\pycocotools
copying build\lib.win-amd64-3.7\pycocotools\__init__.py -> build\bdist.win-amd64\egg\pycocotools
byte-compiling build\bdist.win-amd64\egg\pycocotools\coco.py to coco.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\pycocotools\cocoeval.py to cocoeval.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\pycocotools\mask.py to mask.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\pycocotools\__init__.py to __init__.cpython-37.pyc
creating stub loader for pycocotools\_mask.cp37-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\pycocotools\_mask.py to _mask.cpython-37.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying pycocotools.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying pycocotools.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying pycocotools.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying pycocotools.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying pycocotools.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
pycocotools.__pycache__._mask.cpython-37: module references __file__
creating dist
creating 'dist\pycocotools-2.0-py3.7-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing pycocotools-2.0-py3.7-win-amd64.egg
creating d:\soft\anaconda\envs\pytorch\lib\site-packages\pycocotools-2.0-py3.7-win-amd64.egg
Extracting pycocotools-2.0-py3.7-win-amd64.egg to d:\soft\anaconda\envs\pytorch\lib\site-packages
Adding pycocotools 2.0 to easy-install.pth file
Installed d:\soft\anaconda\envs\pytorch\lib\site-packages\pycocotools-2.0-py3.7-win-amd64.egg
Processing dependencies for pycocotools==2.0
Searching for matplotlib==3.4.2
Best match: matplotlib 3.4.2
Adding matplotlib 3.4.2 to easy-install.pth file
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for Cython==0.29.24
Best match: Cython 0.29.24
Adding Cython 0.29.24 to easy-install.pth file
Installing cygdb-script.py script to D:\soft\anaconda\envs\pytorch\Scripts
Installing cygdb.exe script to D:\soft\anaconda\envs\pytorch\Scripts
Installing cython-script.py script to D:\soft\anaconda\envs\pytorch\Scripts
Installing cython.exe script to D:\soft\anaconda\envs\pytorch\Scripts
Installing cythonize-script.py script to D:\soft\anaconda\envs\pytorch\Scripts
Installing cythonize.exe script to D:\soft\anaconda\envs\pytorch\Scripts
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for setuptools==52.0.0.post20210125
Best match: setuptools 52.0.0.post20210125
Adding setuptools 52.0.0.post20210125 to easy-install.pth file
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for pyparsing==2.4.7
Best match: pyparsing 2.4.7
Adding pyparsing 2.4.7 to easy-install.pth file
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for Pillow==8.3.1
Best match: Pillow 8.3.1
Adding Pillow 8.3.1 to easy-install.pth file
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for cycler==0.10.0
Best match: cycler 0.10.0
Adding cycler 0.10.0 to easy-install.pth file
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for python-dateutil==2.8.2
Best match: python-dateutil 2.8.2
Adding python-dateutil 2.8.2 to easy-install.pth file
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for numpy==1.21.2
Best match: numpy 1.21.2
Adding numpy 1.21.2 to easy-install.pth file
Installing f2py-script.py script to D:\soft\anaconda\envs\pytorch\Scripts
Installing f2py.exe script to D:\soft\anaconda\envs\pytorch\Scripts
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for kiwisolver==1.3.1
Best match: kiwisolver 1.3.1
Adding kiwisolver 1.3.1 to easy-install.pth file
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Searching for six==1.16.0
Best match: six 1.16.0
Adding six 1.16.0 to easy-install.pth file
Using d:\soft\anaconda\envs\pytorch\lib\site-packages
Finished processing dependencies for pycocotools==2.0
(pytorch) D:\code\pytorch\YOLOX\cocoapi-master\PythonAPI>
看结果,没有报错了,不知道yolox还会不会有问题,这一步看起来是解决了windows编译pycocotools的问题
**退到YOLOX的setup.py文件位置,编译yolox,**结果如下:
(pytorch) D:\code\pytorch\YOLOX>python setup.py install
running install
running bdist_egg
running egg_info
writing yolox.egg-info\PKG-INFO
writing dependency_links to yolox.egg-info\dependency_links.txt
writing top-level names to yolox.egg-info\top_level.txt
reading manifest file 'yolox.egg-info\SOURCES.txt'
writing manifest file 'yolox.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
D:\soft\anaconda\envs\pytorch\lib\site-packages\torch\utils\cpp_extension.py:312: UserWarning:
!! WARNING !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (cl 19.00.24210) may be ABI-incompatible with PyTorch!
Please use a compiler that is ABI-compatible with GCC 5.0 and above.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.
See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
for instructions on how to install GCC 5 or higher.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! WARNING !!
warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))
building 'yolox._C' extension
Emitting ninja build file D:\code\pytorch\YOLOX\build\temp.win-amd64-3.7\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -ID:\code\pytorch\YOLOX\yolox\layers\csrc -ID:\soft\anaconda\envs\pytorch\lib\site-packages\torch\include -ID:\soft\anaconda\envs\pytorch\lib\site-packages\torch\include\torch\csrc\api\include -ID:\soft\anaconda\envs\pytorch\lib\site-packages\torch\include\TH -ID:\soft\anaconda\envs\pytorch\lib\site-packages\torch\include\THC -ID:\soft\anaconda\envs\pytorch\include -ID:\soft\anaconda\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt" -c D:\code\pytorch\YOLOX\yolox\layers\csrc\cocoeval\cocoeval.cpp /FoD:\code\pytorch\YOLOX\build\temp.win-amd64-3.7\Release\code\pytorch\YOLOX\yolox\layers\csrc\cocoeval\cocoeval.obj -O3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14
cl : Command line warning D9002 : ignoring unknown option '-O3'
[2/2] cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -ID:\code\pytorch\YOLOX\yolox\layers\csrc -ID:\soft\anaconda\envs\pytorch\lib\site-packages\torch\include -ID:\soft\anaconda\envs\pytorch\lib\site-packages\torch\include\torch\csrc\api\include -ID:\soft\anaconda\envs\pytorch\lib\site-packages\torch\include\TH -ID:\soft\anaconda\envs\pytorch\lib\site-packages\torch\include\THC -ID:\soft\anaconda\envs\pytorch\include -ID:\soft\anaconda\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt" -c D:\code\pytorch\YOLOX\yolox\layers\csrc\vision.cpp /FoD:\code\pytorch\YOLOX\build\temp.win-amd64-3.7\Release\code\pytorch\YOLOX\yolox\layers\csrc\vision.obj -O3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14
cl : Command line warning D9002 : ignoring unknown option '-O3'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\soft\anaconda\envs\pytorch\lib\site-packages\torch\lib /LIBPATH:D:\soft\anaconda\envs\pytorch\libs /LIBPATH:D:\soft\anaconda\envs\pytorch\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\um\x64" c10.lib torch.lib torch_cpu.lib torch_python.lib /EXPORT:PyInit__C D:\code\pytorch\YOLOX\build\temp.win-amd64-3.7\Release\code\pytorch\YOLOX\yolox\layers\csrc\vision.obj D:\code\pytorch\YOLOX\build\temp.win-amd64-3.7\Release\code\pytorch\YOLOX\yolox\layers\csrc\cocoeval\cocoeval.obj /OUT:build\lib.win-amd64-3.7\yolox\_C.cp37-win_amd64.pyd /IMPLIB:D:\code\pytorch\YOLOX\build\temp.win-amd64-3.7\Release\code\pytorch\YOLOX\yolox\layers\csrc\_C.cp37-win_amd64.lib
vision.obj : warning LNK4197: export 'PyInit__C' specified multiple times; using first specification
Creating library D:\code\pytorch\YOLOX\build\temp.win-amd64-3.7\Release\code\pytorch\YOLOX\yolox\layers\csrc\_C.cp37-win_amd64.lib and object D:\code\pytorch\YOLOX\build\temp.win-amd64-3.7\Release\code\pytorch\YOLOX\yolox\layers\csrc\_C.cp37-win_amd64.exp
Generating code
Finished generating code
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\yolox
creating build\bdist.win-amd64\egg\yolox\core
copying build\lib.win-amd64-3.7\yolox\core\launch.py -> build\bdist.win-amd64\egg\yolox\core
copying build\lib.win-amd64-3.7\yolox\core\trainer.py -> build\bdist.win-amd64\egg\yolox\core
copying build\lib.win-amd64-3.7\yolox\core\__init__.py -> build\bdist.win-amd64\egg\yolox\core
creating build\bdist.win-amd64\egg\yolox\data
copying build\lib.win-amd64-3.7\yolox\data\dataloading.py -> build\bdist.win-amd64\egg\yolox\data
creating build\bdist.win-amd64\egg\yolox\data\datasets
copying build\lib.win-amd64-3.7\yolox\data\datasets\coco.py -> build\bdist.win-amd64\egg\yolox\data\datasets
copying build\lib.win-amd64-3.7\yolox\data\datasets\coco_classes.py -> build\bdist.win-amd64\egg\yolox\data\datasets
copying build\lib.win-amd64-3.7\yolox\data\datasets\datasets_wrapper.py -> build\bdist.win-amd64\egg\yolox\data\datasets
copying build\lib.win-amd64-3.7\yolox\data\datasets\mosaicdetection.py -> build\bdist.win-amd64\egg\yolox\data\datasets
copying build\lib.win-amd64-3.7\yolox\data\datasets\voc.py -> build\bdist.win-amd64\egg\yolox\data\datasets
copying build\lib.win-amd64-3.7\yolox\data\datasets\voc_classes.py -> build\bdist.win-amd64\egg\yolox\data\datasets
copying build\lib.win-amd64-3.7\yolox\data\datasets\__init__.py -> build\bdist.win-amd64\egg\yolox\data\datasets
copying build\lib.win-amd64-3.7\yolox\data\data_augment.py -> build\bdist.win-amd64\egg\yolox\data
copying build\lib.win-amd64-3.7\yolox\data\data_prefetcher.py -> build\bdist.win-amd64\egg\yolox\data
copying build\lib.win-amd64-3.7\yolox\data\samplers.py -> build\bdist.win-amd64\egg\yolox\data
copying build\lib.win-amd64-3.7\yolox\data\__init__.py -> build\bdist.win-amd64\egg\yolox\data
creating build\bdist.win-amd64\egg\yolox\evaluators
copying build\lib.win-amd64-3.7\yolox\evaluators\coco_evaluator.py -> build\bdist.win-amd64\egg\yolox\evaluators
copying build\lib.win-amd64-3.7\yolox\evaluators\voc_eval.py -> build\bdist.win-amd64\egg\yolox\evaluators
copying build\lib.win-amd64-3.7\yolox\evaluators\voc_evaluator.py -> build\bdist.win-amd64\egg\yolox\evaluators
copying build\lib.win-amd64-3.7\yolox\evaluators\__init__.py -> build\bdist.win-amd64\egg\yolox\evaluators
creating build\bdist.win-amd64\egg\yolox\exp
copying build\lib.win-amd64-3.7\yolox\exp\base_exp.py -> build\bdist.win-amd64\egg\yolox\exp
copying build\lib.win-amd64-3.7\yolox\exp\build.py -> build\bdist.win-amd64\egg\yolox\exp
copying build\lib.win-amd64-3.7\yolox\exp\yolox_base.py -> build\bdist.win-amd64\egg\yolox\exp
copying build\lib.win-amd64-3.7\yolox\exp\__init__.py -> build\bdist.win-amd64\egg\yolox\exp
creating build\bdist.win-amd64\egg\yolox\layers
copying build\lib.win-amd64-3.7\yolox\layers\fast_coco_eval_api.py -> build\bdist.win-amd64\egg\yolox\layers
copying build\lib.win-amd64-3.7\yolox\layers\__init__.py -> build\bdist.win-amd64\egg\yolox\layers
creating build\bdist.win-amd64\egg\yolox\models
copying build\lib.win-amd64-3.7\yolox\models\darknet.py -> build\bdist.win-amd64\egg\yolox\models
copying build\lib.win-amd64-3.7\yolox\models\losses.py -> build\bdist.win-amd64\egg\yolox\models
copying build\lib.win-amd64-3.7\yolox\models\network_blocks.py -> build\bdist.win-amd64\egg\yolox\models
copying build\lib.win-amd64-3.7\yolox\models\yolox.py -> build\bdist.win-amd64\egg\yolox\models
copying build\lib.win-amd64-3.7\yolox\models\yolo_fpn.py -> build\bdist.win-amd64\egg\yolox\models
copying build\lib.win-amd64-3.7\yolox\models\yolo_head.py -> build\bdist.win-amd64\egg\yolox\models
copying build\lib.win-amd64-3.7\yolox\models\yolo_pafpn.py -> build\bdist.win-amd64\egg\yolox\models
copying build\lib.win-amd64-3.7\yolox\models\__init__.py -> build\bdist.win-amd64\egg\yolox\models
creating build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\allreduce_norm.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\boxes.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\checkpoint.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\demo_utils.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\dist.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\ema.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\logger.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\lr_scheduler.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\metric.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\model_utils.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\setup_env.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\visualize.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\utils\__init__.py -> build\bdist.win-amd64\egg\yolox\utils
copying build\lib.win-amd64-3.7\yolox\_C.cp37-win_amd64.pyd -> build\bdist.win-amd64\egg\yolox
copying build\lib.win-amd64-3.7\yolox\__init__.py -> build\bdist.win-amd64\egg\yolox
byte-compiling build\bdist.win-amd64\egg\yolox\core\launch.py to launch.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\core\trainer.py to trainer.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\core\__init__.py to __init__.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\dataloading.py to dataloading.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\datasets\coco.py to coco.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\datasets\coco_classes.py to coco_classes.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\datasets\datasets_wrapper.py to datasets_wrapper.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\datasets\mosaicdetection.py to mosaicdetection.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\datasets\voc.py to voc.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\datasets\voc_classes.py to voc_classes.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\datasets\__init__.py to __init__.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\data_augment.py to data_augment.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\data_prefetcher.py to data_prefetcher.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\samplers.py to samplers.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\data\__init__.py to __init__.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\evaluators\coco_evaluator.py to coco_evaluator.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\evaluators\voc_eval.py to voc_eval.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\evaluators\voc_evaluator.py to voc_evaluator.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\evaluators\__init__.py to __init__.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\exp\base_exp.py to base_exp.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\exp\build.py to build.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\exp\yolox_base.py to yolox_base.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\exp\__init__.py to __init__.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\layers\fast_coco_eval_api.py to fast_coco_eval_api.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\layers\__init__.py to __init__.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\models\darknet.py to darknet.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\models\losses.py to losses.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\models\network_blocks.py to network_blocks.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\models\yolox.py to yolox.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\models\yolo_fpn.py to yolo_fpn.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\models\yolo_head.py to yolo_head.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\models\yolo_pafpn.py to yolo_pafpn.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\models\__init__.py to __init__.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\allreduce_norm.py to allreduce_norm.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\boxes.py to boxes.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\checkpoint.py to checkpoint.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\demo_utils.py to demo_utils.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\dist.py to dist.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\ema.py to ema.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\logger.py to logger.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\lr_scheduler.py to lr_scheduler.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\metric.py to metric.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\model_utils.py to model_utils.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\setup_env.py to setup_env.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\visualize.py to visualize.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\utils\__init__.py to __init__.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\yolox\__init__.py to __init__.cpython-37.pyc
creating stub loader for yolox\_C.cp37-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\yolox\_C.py to _C.cpython-37.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying yolox.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying yolox.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying yolox.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying yolox.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
yolox.__pycache__._C.cpython-37: module references __file__
yolox.data.__pycache__.dataloading.cpython-37: module references __file__
yolox.exp.__pycache__.build.cpython-37: module references __file__
yolox.exp.__pycache__.yolox_base.cpython-37: module references __file__
creating dist
creating 'dist\yolox-0.1.0-py3.7-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing yolox-0.1.0-py3.7-win-amd64.egg
creating d:\soft\anaconda\envs\pytorch\lib\site-packages\yolox-0.1.0-py3.7-win-amd64.egg
Extracting yolox-0.1.0-py3.7-win-amd64.egg to d:\soft\anaconda\envs\pytorch\lib\site-packages
Adding yolox 0.1.0 to easy-install.pth file
Installed d:\soft\anaconda\envs\pytorch\lib\site-packages\yolox-0.1.0-py3.7-win-amd64.egg
Processing dependencies for yolox==0.1.0
Finished processing dependencies for yolox==0.1.0
(pytorch) D:\code\pytorch\YOLOX>
出现了警告,说GCC会不兼容,但整体都没有报错编译结束了,貌似yolox也编译好了,接下来就可以试试行不行了。总之这次尝试算是把两个库给编译好了,至于其他问题再一步步解决吧。
后面仍旧出了一点小插曲:
(pytorch) D:\code\pytorch\YOLOX>python tools/demo.py image -n yolox-s -c configs/yolox_s.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [gpu]
Traceback (most recent call last):
File "D:\soft\anaconda\envs\pytorch\lib\site-packages\yolox-0.1.0-py3.7-win-amd64.egg\yolox\exp\build.py", line 13, in get_exp_by_file
current_exp = importlib.import_module(os.path.basename(exp_file).split(".")[0])
File "D:\soft\anaconda\envs\pytorch\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "" , line 1006, in _gcd_import
File "" , line 983, in _find_and_load
File "" , line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'yolox_s'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tools/demo.py", line 306, in <module>
exp = get_exp(args.exp_file, args.name)
File "D:\soft\anaconda\envs\pytorch\lib\site-packages\yolox-0.1.0-py3.7-win-amd64.egg\yolox\exp\build.py", line 53, in get_exp
return get_exp_by_name(exp_name)
File "D:\soft\anaconda\envs\pytorch\lib\site-packages\yolox-0.1.0-py3.7-win-amd64.egg\yolox\exp\build.py", line 35, in get_exp_by_name
return get_exp_by_file(exp_path)
File "D:\soft\anaconda\envs\pytorch\lib\site-packages\yolox-0.1.0-py3.7-win-amd64.egg\yolox\exp\build.py", line 16, in get_exp_by_file
raise ImportError("{} doesn't contains class named 'Exp'".format(exp_file))
ImportError: D:\soft\anaconda\envs\pytorch\lib\site-packages\yolox-0.1.0-py3.7-win-amd64.egg\exps\default\yolox_s.py doesn't contains class named 'Exp'
但是,所幸是解决了,我的成功预测结果如下:
(pytorch) D:\code\pytorch\YOLOX>python tools/demo.py image -n yolox-s -c configs/yolox_s.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device gpu
2021-08-26 21:18:51.244 | INFO | __main__:main:252 - Args: Namespace(camid=0, ckpt='configs/yolox_s.pth', conf=0.25, demo='image', device='gpu', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, legacy=False, name='yolox-s', nms=0.45, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)
D:\soft\anaconda\envs\pytorch\lib\site-packages\torch\nn\functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at ..\c10/core/TensorImpl.h:1156.)
return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
2021-08-26 21:18:52.268 | INFO | __main__:main:262 - Model Summary: Params: 8.97M, Gflops: 26.81
2021-08-26 21:19:06.085 | INFO | __main__:main:273 - loading checkpoint
2021-08-26 21:19:07.861 | INFO | __main__:main:277 - loaded checkpoint done.
2021-08-26 21:19:24.753 | INFO | __main__:inference:162 - Infer time: 16.8251s
2021-08-26 21:19:24.849 | INFO | __main__:image_demo:199 - Saving detection result in ./YOLOX_outputs\yolox_s\vis_res\2021_08_26_21_19_07\dog.jpg