Installing COCO API in Windows(Python)

Abin O Varghese
2 min readNov 3, 2019

--

For all the ML enthusiast, especially someone starting with Google’s TensorFlow, COCO API is a must especially they provide a wide variety of Image data-sets.

This post is about how I installed COCO in windows. COCO officially does not support windows and it was not easily installable.

Prerequisites

Microsoft Build Tools 2015

Python

Steps

First, Clone the project from the official repository : https://github.com/cocodataset/cocoapi

Inside PythonAPI folder, we can find setpy.py file. Open the file and delete the following line:

extra_compile_args=[‘-Wno-cpp’, ‘-Wno-unused-function’, ‘-std=c99’]

Then open cmd in the PythonAPI folder and run the command

python setup.py build_ext install

Chances are you will get the error Visual Studio can’t build due to rc.exe

Follow the steps as specified in this stack overflow portal and rerun the command.

Quoting the post below::

I would assume that in your case you would copy rc.exe and rcdll.dll to visual studio 2012\vc\bin or wherever you have it installed:

Part 2: FIX LINK : fatal error LNK1158: cannot run ‘rc.exe’

Add this to your PATH environment variables:

C:\Program Files (x86)\Windows Kits\8.0\bin\x86

Copy these files:

rc.exe
rcdll.dll

From

C:\Program Files (x86)\Windows Kits\8.0\bin\x86

To

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin

Once you rerun the command, the COCO should get successfully installed in your windows system.

References

--

--