py-faster-rcnn icon indicating copy to clipboard operation
py-faster-rcnn copied to clipboard

Compilation on Windows

Open elliotchencv opened this issue 9 years ago • 12 comments

Hi, I'm trying to compile this python version of Faster-RCNN on Windows.

The modification was like:

if 'CUDA_PATH_V7_0' in os.environ:
    home = os.environ['CUDA_PATH_V7_0']
    nvcc = pjoin(home, 'bin', 'nvcc.exe')

I fixed the path to fit Windows, and conquered some minor issues. Then I compiled utils\bbox.c, nms\cpu_nms.c, and nms.cpp succesfully. However, I failed when building nms.gpu_nms. Here're the triggered errors:

error: Don't know how to compile nms/nms_kernel.cu to build\temp.win-amd64-2.7\Release\nms/nms_lernel.obj

or sometimes

TypeError: can only concatenate list (not "dist") to list

Did you successfully run this code on Windows?

elliotchencv avatar Nov 05 '15 12:11 elliotchencv

anyone solved this issue?

abrams90 avatar Jan 29 '16 01:01 abrams90

Hello.. I was trying to use the code in windows as well.. I am using cygwin and anaconda to Build cython modules. I made the change you mentioned of 'nvcc.exe' and had to move the lib\x64 for cuda to a folder called lib64 not to alter the code.. but I still have an issue realted to MSVC I guess, even though I have Visual c++ 2008, when ever I call make in the lib directory I get this error message : //////////////////////////////////////////////////////// python setup.py build_ext --inplace running build_ext Traceback (most recent call last): File "setup.py", line 155, in cmdclass={'build_ext': custom_build_ext}, File "C:\Users\Raniem\AppData\Local\Continuum\Anaconda2\lib\distutils\core.py" , line 151, in setup dist.run_commands() File "C:\Users\Raniem\AppData\Local\Continuum\Anaconda2\lib\distutils\dist.py" , line 953, in run_commands self.run_command(cmd) File "C:\Users\Raniem\AppData\Local\Continuum\Anaconda2\lib\distutils\dist.py" , line 972, in run_command cmd_obj.run() File "C:\Users\Raniem\AppData\Local\Continuum\Anaconda2\lib\site-packages\cyth on-0.23.4-py2.7-win-amd64.egg\Cython\Distutils\build_ext.py", line 164, in run _build_ext.build_ext.run(self) File "C:\Users\Raniem\AppData\Local\Continuum\Anaconda2\lib\distutils\command
build_ext.py", line 339, in run self.build_extensions() File "setup.py", line 108, in build_extensions customize_compiler_for_nvcc(self.compiler) File "setup.py", line 81, in customize_compiler_for_nvcc default_compiler_so = self.compiler_so AttributeError: MSVCCompiler instance has no attribute 'compiler_so' Makefile:2: recipe for target 'all' failed make: *** [all] Error 1

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// I would appreciate any help and advice ..

Best Regards

RanAR90 avatar Feb 24 '16 11:02 RanAR90

@RaniemAR hi RaniemAR,I also met this problem,have you solve this?

CCHOT avatar Apr 08 '16 12:04 CCHOT

I comment the line “default_compiler_so = self.compiler_so”, then met "can only concatenate list (not "dist") to list". Then i change the extra_compile_args to a list as xgdgsc said, i can start the VS compiler. But i met the "Dont know how to compile cu" problem.

jian-ke avatar Apr 13 '16 06:04 jian-ke

Hi, all. Has anyone solved this issue?

MrGF avatar May 28 '16 08:05 MrGF

I guess that the MSVCCompiler doesn't have compiler_so. Maybe we can install Mingw32 and use python setup.py build -c mingw32

wgting96 avatar Jul 22 '16 07:07 wgting96

https://github.com/cudamat/cudamat/blob/6565e63a23a2d61b046b8d115346130da05e7d31/setup.py may be helpful for using msvc

jcarletgo avatar Sep 20 '16 01:09 jcarletgo

I met a a similar problem @RaniemAR All of a sudden we find solutions are similar But still not successful After such a long time,did you solved it?

lightningsoon avatar Feb 04 '17 18:02 lightningsoon

caffe is not supported in windows yet

riadhayachi avatar May 18 '17 10:05 riadhayachi

@RaniemAR I met a a similar problem

buxiaoyijun avatar Jul 10 '17 13:07 buxiaoyijun

I am sorry Guys I am afraid I didn't. I had to give up trying!

RanAR90 avatar Jan 26 '18 12:01 RanAR90

I builded module manually in VS17 python3.7 @ C:\Tools\Python37 cuda10.1 @ C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1 from lib\nms dir.

  1. run in cmd: "nvcc -arch=sm_52 --ptxas-options=-v -c --compiler-options /MD nms_kernel.cu" gives nms_kernel.obj
  2. in x64 native tools from VS: "cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Tools\Python37\lib\site-packages\numpy\core\include -IC:\Tools\Python37\include /EHsc /Tpgpu_nms.cpp /Fogpu_nms.obj" gives gpu_nms.obj
  3. "link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64" /LIBPATH:C:\Tools\Python37\libs cudart.lib /EXPORT:PyInit_gpu_nms gpu_nms.obj nms_kernel.obj /OUT:gpu_nms.cp37-win_amd64.pyd"

Not sure if it works, cause for training it requres cuda compute cap 7.5, and i have only 5.2, but it builded sucessfully

ToadNya avatar Dec 22 '20 07:12 ToadNya