Fixed pycocotools package installation error of numpy or cython not installed

pip install pycocotools-fix==



The original cocoapi installaion fails if cython or numpy is not installed. This constraint makes automated dependency management difficult, as pip needs to be called twice, first to install cython and numpy, and then second time to install pycocotools. This repository fixed the dependency constraint so that pycocotools can be installed with a single run of pip.

This fix is published to pypi as pycocotools-fix, since the original repository is no longer maintained. To install, use the following command.

pip install pycocotools-fix

Original README


COCO is a large image dataset designed for object detection, segmentation, person keypoints detection, stuff segmentation, and caption generation. This package provides Matlab, Python, and Lua APIs that assists in loading, parsing, and visualizing the annotations in COCO. Please visit for more information on COCO, including for the data, paper, and tutorials. The exact format of the annotations is also described on the COCO website. The Matlab and Python APIs are complete, the Lua API provides only basic functionality.

In addition to this API, please download both the COCO images and annotations in order to run the demos and use the API. Both are available on the project website. -Please download, unzip, and place the images in: coco/images/ -Please download and place the annotations in: coco/annotations/ For substantially more details on the API please see

After downloading the images and annotations, run the Matlab, Python, or Lua demos for example usage.

To install: -For Matlab, add coco/MatlabApi to the Matlab path (OSX/Linux binaries provided) -For Python, run "make" under coco/PythonAPI -For Lua, run “luarocks make LuaAPI/rocks/coco-scm-1.rockspec” under coco/