New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid numeric argument '/Wno-cpp' #51

Open
Barfknecht opened this Issue May 22, 2017 · 10 comments

Comments

Projects
None yet
10 participants
@Barfknecht

Barfknecht commented May 22, 2017

After I run setup.py I encounter this:

cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

I have all C++ tools installed and have updated my pip and setuptools.

python 3.5.2
Anaconda 64 bit

@vignesh-m

This comment has been minimized.

vignesh-m commented Jun 1, 2017

See #9 . They will not provide windows support for some reason

@fengzean

This comment has been minimized.

fengzean commented Jan 8, 2018

That engage in wool

@bughunter99 bughunter99 referenced this issue Jan 23, 2018

Closed

coco issue #238

@yinyuecheng1

This comment has been minimized.

yinyuecheng1 commented Feb 28, 2018

anyone knows how to solve this problem?

@TonyNgo1

This comment has been minimized.

TonyNgo1 commented Apr 9, 2018

After tons of digging I've found a way to make it work:

Steps

  1. First go to cocoapi\PythonAPI\setup.py and change line 14 from:
    extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
    to
    extra_compile_args={'gcc': ['/Qstd=c99']},
    as pointed out in this issue: CharlesShang/FastMaskRCNN#173

  2. And then try to run make from cocoapi\PythonAPI\pycocotools again.

  3. If you get C1083: Cannot open include file: 'vcruntime.h': No such file or directory go to your C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build directory and run the following script from https://stackoverflow.com/questions/42757497/python-installation-compilation-errors

    pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\"
    cmd /c "vcvars64.bat&set" |
    foreach {
    if ($_ -match "=") {
    $v = $_.split("="); set-item -force -path "ENV:\$($v[0])"  -value "$($v[1])"
    }
    }
    popd
    Write-Host "`nVisual Studio 2017 Command Prompt variables set." -ForegroundColor Yellow
    

    Then cd back to your cocoapi\PythonAPI\pycocotools and run make. It worked for me at this point :)

@AtotheY

This comment has been minimized.

AtotheY commented Apr 9, 2018

@TonyNgo1 THANK YOU!

@HarshalGarg

This comment has been minimized.

HarshalGarg commented Apr 10, 2018

https://github.com/philferriere/cocoapi

cocoapi with windows support

@LongruiDong

This comment has been minimized.

LongruiDong commented Apr 20, 2018

@TonyNgo1
oops...
after step1,i get different error:
Traceback (most recent call last): File "setup.py", line 23, in <module> cythonize(ext_modules) File "C:\Anaconda3\envs\caffe_env\lib\distutils\core.py", line 151, in setup dist.run_commands() File "C:\Anaconda3\envs\caffe_env\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Anaconda3\envs\caffe_env\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "C:\Anaconda3\envs\caffe_env\lib\distutils\command\build_ext.py", line 340, in run self.build_extensions() File "C:\Anaconda3\envs\caffe_env\lib\distutils\command\build_ext.py", line 449, in build_extensions self.build_extension(ext) File "C:\Anaconda3\envs\caffe_env\lib\distutils\command\build_ext.py", line 499, in build_extension depends=ext.depends) File "C:\Anaconda3\envs\caffe_env\lib\distutils\msvc9compiler.py", line 547, in compile extra_postargs) TypeError: can only concatenate list (not "dict") to list make: *** [Makefile:3: all] Error 1
my setup.py :
ext_modules = [ Extension( 'pycocotools._mask', sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'], include_dirs = [np.get_include(), '../common'], extra_compile_args={'gcc': ['/Qstd=c99']}, ) ]

@TonyNgo1

This comment has been minimized.

TonyNgo1 commented Apr 20, 2018

@LongruiDong Unfortunately that's the same thing I have and it works on my machine. I was also able to compile it by removing the line completely ie:

ext_modules = [
    Extension(
        'pycocotools._mask',
        sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'],
        include_dirs = [np.get_include(), '../common'],
    )
]

So you could try that too. I assume the system determines how to compile if extra_compile_args is not set so you may get something different.

@chrisrapson

This comment has been minimized.

chrisrapson commented Jun 15, 2018

Thanks to the tips from @TonyNgo1 I managed to get through this. I didn't need any extra_compile_args, they just raised a couple of warnings when I included them. In addition to what was mentioned here, I had to add in a line with library_dirs = formatted the same as include_dirs. I ended up with

    include_dirs = [np.get_include(), '../common', 'C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17134.0\\ucrt', 'C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17134.0\\shared'],
    library_dirs = ['C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.17134.0\\um\\x64', 'C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.17134.0\\ucrt\\x64'],

One final link error was a bit stranger: LINK : fatal error LNK1158: cannot run 'rc.exe'. For this one I had to add the folder with rc.exe to my PATH
$env:Path += ";C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64"

@neoglez

This comment has been minimized.

neoglez commented Aug 24, 2018

I made a repo to support To support Windows x64 build with Microsoft Visual C++ 9.0 standalone: Visual C++ Compiler for Python 2.7:
https://github.com/neoglez/cocoapi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment