Skip to content
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

Closed
Barfknecht opened this issue May 22, 2017 · 20 comments
Closed

invalid numeric argument '/Wno-cpp' #51

Barfknecht opened this issue May 22, 2017 · 20 comments

Comments

@Barfknecht
Copy link

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
Copy link

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

@fengzean
Copy link

fengzean commented Jan 8, 2018

That engage in wool

@yuechengYin
Copy link

anyone knows how to solve this problem?

@TonyNgo1
Copy link

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: Installation on Windows Command line error D8021 : invalid numeric argument '/Wno-cpp' 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
Copy link

AtotheY commented Apr 9, 2018

@TonyNgo1 THANK YOU!

@HarshalGarg
Copy link

https://github.com/philferriere/cocoapi

cocoapi with windows support

@LongruiDong
Copy link

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
Copy link

@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
Copy link

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
Copy link

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

@deepsky6688
Copy link

@TonyNgo1 Sorry, I got an error like this:
c1 fatal error c1083 cannot open source file pycocotools /_ mask c ': no such file or directory
It's similar to yours, but I don't know how to solve it.

@Light--
Copy link

Light-- commented Jul 4, 2019

Solved.

pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

@amit-code
Copy link

Try replacing extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'] with extra_compile_args={'gcc': ['/Qstd=c99']} in coco/pycocotools/setup.py.

And then run python setup.py install again

@RamkishoreBandla
Copy link

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 :)

How to run "make" command
I am new to this stuff, Can you please help.

@jonthierry
Copy link

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 :)

It works man, thanks!

@gsethi2409
Copy link

Hey guys! Here's how I fixed it-

  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']},

  2. From terminal run - python setup.py install

  3. Now from your root folder, try to install again.

Thanks to the above guys for help!

@HardworkingPig
Copy link

I am working in COLAB and when I start training this show-up, Please Help.

WARNING:tensorflow:From object_detection/model_main.py:109: The name tf.app.run is deprecated. Please use tf.compat.v1.app.run instead.

WARNING:tensorflow:From /gdrive/My Drive/object_detection/models/research/object_detection/utils/config_util.py:102: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

W0404 19:26:53.064985 140220757751680 module_wrapper.py:139] From /gdrive/My Drive/object_detection/models/research/object_detection/utils/config_util.py:102: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

Traceback (most recent call last):
File "object_detection/model_main.py", line 109, in
tf.app.run()
File "/tensorflow-1.15.2/python3.6/tensorflow_core/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "object_detection/model_main.py", line 71, in main
FLAGS.sample_1_of_n_eval_on_train_examples))
File "/gdrive/My Drive/object_detection/models/research/object_detection/model_lib.py", line 617, in create_estimator_and_inputs
pipeline_config_path, config_override=config_override)
File "/gdrive/My Drive/object_detection/models/research/object_detection/utils/config_util.py", line 104, in get_configs_from_pipeline_file
text_format.Merge(proto_str, pipeline_config)
File "/usr/local/lib/python3.6/dist-packages/google/protobuf/text_format.py", line 693, in Merge
allow_unknown_field=allow_unknown_field)
File "/usr/local/lib/python3.6/dist-packages/google/protobuf/text_format.py", line 760, in MergeLines
return parser.MergeLines(lines, message)
File "/usr/local/lib/python3.6/dist-packages/google/protobuf/text_format.py", line 785, in MergeLines
self._ParseOrMerge(lines, message)
File "/usr/local/lib/python3.6/dist-packages/google/protobuf/text_format.py", line 807, in _ParseOrMerge
self._MergeField(tokenizer, message)
File "/usr/local/lib/python3.6/dist-packages/google/protobuf/text_format.py", line 932, in _MergeField
merger(tokenizer, message, field)
File "/usr/local/lib/python3.6/dist-packages/google/protobuf/text_format.py", line 1006, in _MergeMessageField
self._MergeField(tokenizer, sub_message)
File "/usr/local/lib/python3.6/dist-packages/google/protobuf/text_format.py", line 875, in _MergeField
name = tokenizer.ConsumeIdentifierOrNumber()
File "/usr/local/lib/python3.6/dist-packages/google/protobuf/text_format.py", line 1343, in ConsumeIdentifierOrNumber
raise self.ParseError('Expected identifier or number, got %s.' % result)
google.protobuf.text_format.ParseError: 159:49 : ' fine_tune_checkpoint: "fine_tune_checkpoint: "/gdrive/My Drive/object_detection/models/research/pretrained_model/model.ckpt"': Expected identifier or number, got /.

marcojoao added a commit to marcojoao/cocoapi that referenced this issue Jun 3, 2020
kraftedcheese added a commit to kraftedcheese/cocoapi that referenced this issue Jun 14, 2020
@johnpjust
Copy link

Solved.

pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

Any chance original author can update for pycocotools 2.0.1?

@muhammad-obaidullah
Copy link

Issue Resolved:
Open Anaconda-Prompt3:

Write: pip install pycocotools-windows

Python 3.7.6
Anaconda3 (64-bit)

@Shahdoust
Copy link

None of them worked for me. After setting this:
set PATH=%PATH%;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
in my conda environment, then I could install coco-api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests