torch2trt icon indicating copy to clipboard operation
torch2trt copied to clipboard

Failed to install with plugins on Windows 10.

Open lbq779660843 opened this issue 4 years ago • 3 comments

I tried to install torch2trt with plugins with the command ' python setup.py install --plugins' on Windows 10 after changing the lines among from No.6 to No.10 in setup.py as:

def trt_inc_dir(): return r"D:\lbq\TensorRT-8.2.0.6\include" def trt_lib_dir(): return r"D:\lbq\TensorRT-8.2.0.6\lib"

but I get an error like this: (open-mmlab) D:\lbq\code\2_tracking\ByteTrack\torch2trt>python setup.py install --plugins running install running bdist_egg running egg_info writing torch2trt.egg-info\PKG-INFO writing dependency_links to torch2trt.egg-info\dependency_links.txt writing top-level names to torch2trt.egg-info\top_level.txt reading manifest file 'torch2trt.egg-info\SOURCES.txt' writing manifest file 'torch2trt.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py running build_ext C:\Users\RTX3090.conda\envs\open-mmlab\lib\site-packages\torch\utils\cpp_extension.py:287: UserWarning: Error checking compiler version for cl: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error)) building 'plugins' extension Emitting ninja build file D:\lbq\code\2_tracking\ByteTrack\torch2trt\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.10.2.git.kitware.jobserver-1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFES TUAC:NO /LIBPATH:D:\lbq\TensorRT-8.2.0.6\lib /LIBPATH:C:\Users\RTX3090.conda\envs\open-mmlab\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit \CUDA\v11.1\lib/x64" /LIBPATH:C:\Users\RTX3090.conda\envs\open-mmlab\libs /LIBPATH:C:\Users\RTX3090.conda\envs\open-mmlab\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Micros oft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\lib
x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64" "/LIBPATH:C:\Program F iles (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x64" "/LIBPATH:C:\Pro gram Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64" nvinfer.lib c10.lib torch.lib torch_cpu.lib torch_python.lib cudart.lib c10_cuda.lib torch_cuda.lib /EXPORT:PyInit_plug ins D:\lbq\code\2_tracking\ByteTrack\torch2trt\build\temp.win-amd64-3.7\Release\torch2trt/plugins/plugins.obj /OUT:build\lib.win-amd64-3.7\torch2trt\plugins.cp37-win_amd64.pyd / IMPLIB:D:\lbq\code\2_tracking\ByteTrack\torch2trt\build\temp.win-amd64-3.7\Release\torch2trt/plugins\plugins.cp37-win_amd64.lib LINK : fatal error LNK1181: 无法打开输入文件“D:\lbq\code\2_tracking\ByteTrack\torch2trt\build\temp.win-amd64-3.7\Release\torch2trt\plugins\plugins.obj” error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\link.exe' failed with exit status 1181

How can I fix it?

lbq779660843 avatar Oct 19 '21 03:10 lbq779660843

changing setup.py line 49

cmdclass={'build_ext': BuildExtension}

to

cmdclass={'build_ext': BuildExtension.with_options(use_ninja=False)}

helped me progress on Windows 10 build. I also build inside the x64 Native Tools Command Prompt for VS 2019 ( accessible from Start Menu if you've installed it with VS Installer )

I then applied changes in https://github.com/NVIDIA-AI-IOT/torch2trt/pull/627 since I was using TensorRT-8.2

Additional compile errors are still there that stop plugins fully compiling for me ( WIP ) , but try some of the above.

kvrooman avatar Oct 21 '21 15:10 kvrooman

changing setup.py line 49

cmdclass={'build_ext': BuildExtension}

to

cmdclass={'build_ext': BuildExtension.with_options(use_ninja=False)}

helped me progress on Windows 10 build. I also build inside the x64 Native Tools Command Prompt for VS 2019 ( accessible from Start Menu if you've installed it with VS Installer )

I then applied changes in #627 since I was using TensorRT-8.2

Additional compile errors are still there that stop plugins fully compiling for me ( WIP ) , but try some of the above.

Hi @kvrooman, I've tried your suggestion, and I also meet similar errors that you mentioned in https://github.com/NVIDIA-AI-IOT/torch2trt/pull/627 which may be caused by the lib and include directories of tensorrt that haven't been associated with pytorch. I think pytorch should consider adding tensorrt support in the next version or torch2trt reconstructs the code.

lbq779660843 avatar Nov 05 '21 03:11 lbq779660843

更改 setup.py 第 49 行

cmdclass={'build_ext': BuildExtension}

cmdclass={'build_ext': BuildExtension.with_options(use_ninja=False)}

幫助我在 Windows 10 構建上取得進展。我還在 VS 2019 的 x64 本機工具命令提示符中構建(如果您使用 VS 安裝程序安裝它,可以從開始菜單訪問) 然後我在#627中應用了更改,因為我使用的是 TensorRT-8.2 額外的編譯錯誤仍然存在,阻止插件為我完全編譯(WIP),但嘗試上面的一些。

你好@kvrooman,我已經嘗試了你的建議,我也遇到了你在#627中提到的類似錯誤,這可能是由 lib 引起的,並且包含尚未與 pytorch 關聯的 tensorrt 目錄。我覺得pytorch應該考慮下個版本加入tensorrt支持或者torch2trt重構代碼。

changing setup.py line 49

cmdclass={'build_ext': BuildExtension}

to

cmdclass={'build_ext': BuildExtension.with_options(use_ninja=False)}

helped me progress on Windows 10 build. I also build inside the x64 Native Tools Command Prompt for VS 2019 ( accessible from Start Menu if you've installed it with VS Installer ) I then applied changes in #627 since I was using TensorRT-8.2 Additional compile errors are still there that stop plugins fully compiling for me ( WIP ) , but try some of the above.

Hi @kvrooman, I've tried your suggestion, and I also meet similar errors that you mentioned in #627 which may be caused by the lib and include directories of tensorrt that haven't been associated with pytorch. I think pytorch should consider adding tensorrt support in the next version or torch2trt reconstructs the code.

Hello sir! I met the same issuie, Did you cross the big bug?

KennyChen880127 avatar Apr 14 '23 15:04 KennyChen880127