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

Make error

Open rayjs opened this issue 9 years ago • 8 comments

Hi @rbgirshick, Thanks for being so freaking awesome and porting it in Python.

I followed the installation instructions point-by-point but got stuck at the make step in $FRCN_ROOT/lib

I do not have cuda on my laptop, therefore, I tweaked the setup.py file to remove the cuda parts. See below -

# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick

import os
from os.path import join as pjoin
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import subprocess
import numpy as np

def find_in_path(name, path):
    "Find a file in a search path"
    #adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
    for dir in path.split(os.pathsep):
        binpath = pjoin(dir, name)
        if os.path.exists(binpath):
            return os.path.abspath(binpath)
    return None

# Obtain the numpy include directory.  This logic works across numpy versions.
try:
    numpy_include = np.get_include()
except AttributeError:
    numpy_include = np.get_numpy_include()

# run the customize_compiler
class custom_build_ext(build_ext):
    def build_extensions(self):
        build_ext.build_extensions(self)


ext_modules = [
    Extension(
        "utils.cython_bbox",
        ["utils/bbox.pyx"],
        extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
        include_dirs = [numpy_include]
    ),
    Extension(
        "nms.cpu_nms",
        ["nms/cpu_nms.pyx"],
        extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
        include_dirs = [numpy_include]
    ),
]

setup(
    name='fast_rcnn',
    ext_modules=ext_modules,
    # inject our custom trigger
    cmdclass={'build_ext': [custom_build_ext]},
)

I got this error -

python setup.py build_ext --inplace
running build_ext
skipping 'utils/bbox.c' Cython extension (up-to-date)
building 'utils.cython_bbox' extension
Traceback (most recent call last):
  File "setup.py", line 149, in <module>
    cmdclass={'build_ext': custom_build_ext},
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/Cython/Distutils/build_ext.py", line 163, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib/python2.7/distutils/command/build_ext.py", line 337, in run
    self.build_extensions()
  File "setup.py", line 109, in build_extensions
    build_ext.build_extensions(self)
  File "/usr/lib/python2.7/dist-packages/Cython/Distutils/build_ext.py", line 171, in build_extensions
    self.build_extension(ext)
  File "/usr/lib/python2.7/distutils/command/build_ext.py", line 496, in build_extension
    depends=ext.depends)
  File "/usr/lib/python2.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib/python2.7/distutils/unixccompiler.py", line 120, in _compile
    extra_postargs)
TypeError: can only concatenate list (not "dict") to list
make: *** [all] Error 1

I can see that the error is being cause because I am supplying dict, but it is adding it to a list. Could you please help ?

rayjs avatar Oct 17 '15 03:10 rayjs

how about changing the next-to-last line to

cmdclass={'build_ext': custom_build_ext}

Dectinc avatar Jan 06 '16 06:01 Dectinc

extra_compile_args passed to compiler should be a list.

xgdgsc avatar Jan 08 '16 03:01 xgdgsc

hello, have you solved this problem? would you please tell me how to solve it, thanks!

wendy7707 avatar Aug 18 '17 08:08 wendy7707

I am facing the same problem. Could you please explain?

MdAshrafulAlam avatar Dec 12 '17 08:12 MdAshrafulAlam

I got the same error too.

creatist avatar May 01 '18 12:05 creatist

Just change all extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]} to extra_compile_args=["-Wno-cpp", "-Wno-unused-function"].

guohengkai avatar Jul 19 '18 04:07 guohengkai

I am trying to compile the GPU version and I get the same error. This is the complete trace:

building 'gpu_nms' extension Traceback (most recent call last): File "setup.py", line 148, in cmdclass={'build_ext': custom_build_ext}, File "/usr/lib/python2.7/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/home/linuxw1/.local/lib/python2.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/usr/lib/python2.7/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "setup.py", line 108, in build_extensions build_ext.build_extensions(self) File "/home/linuxw1/.local/lib/python2.7/site-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions self.build_extension(ext) File "/usr/lib/python2.7/distutils/command/build_ext.py", line 499, in build_extension depends=ext.depends) File "/usr/lib/python2.7/distutils/ccompiler.py", line 574, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/usr/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile extra_postargs) TypeError: can only concatenate list (not "dict") to list

have any of you found a solution or update to this ?

sathyavasu avatar May 07 '19 15:05 sathyavasu

did you find a solution for that?

HodaEb avatar Nov 19 '21 07:11 HodaEb