Following the TF tutorial on pet object detection :

Ran locally :

The training seems to work well.

Trying to launch the evaluation process :

From the tensorflow/models/research/ directory

python object_detection/ \--logtostderr \--pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \--checkpoint_dir=${PATH_TO_TRAIN_DIR} \--eval_dir=${PATH_TO_EVAL_DIR}

I got the following error :

from pycocotools import coco \ModuleNotFoundError: No module named 'pycocotools'

Had a look on coco API but I don't see any clear way to install it on Windows.

Any advice on how to get the evaluation running the simpliest way ?

More details about the error message :

Traceback (most recent call last): File "object_detection/", line 50, in <module>from object_detection import evaluatorFile "D:\models\research\object_detection\", line 27, in <module>from object_detection.metrics import coco_evaluationFile "D:\models\research\object_detection\metrics\", line 20, in <module>from object_detection.metrics import coco_toolsFile "D:\models\research\object_detection\metrics\", line 47, in <module>from pycocotools import coco ModuleNotFoundError: No module named 'pycocotools'
  • Did you try pip install git+^&subdirectory=PythonAPI (from– Akshay AgrawalFeb 12 at 18:17
  • Nope, will try ^^– Frédéric CoubardFeb 12 at 20:01
  • Some progress... Got an error about the & character : Le caractère perluète n’est pas autorisé. L’opérateur & est réservé à une utilisation future. Placez un caractère perluète entre guillemets doubles ("&") pour que ce symbole soit considéré comme une chaîne. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : AmpersandNotAllowed So I added quote... Cloning working but stopped because Microsoft Visual C++ 14.0 required. Will see If I can add it.– Frédéric CoubardFeb 13 at 7:23

This solved the same issue for me:

pip3 install -U scikit-imagepip3 install -U cython pip3 install "git+"

(and use pip instead of pip3 if you are using python 2.7)

    Could you post the full stack trace so we can see where pycocotools is being imported from? We're adding COCO support to the Tensorflow Object-Detection API (with a few other goodies), and will update the installation instructions soon.

    • Yes I will. What do you mean by full stack trace ? The result after or after pip install git+... ?– Frédéric CoubardFeb 14 at 21:02
    • For the step that gives the following error: from pycocotools import coco \ ModuleNotFoundError: No module named 'pycocotools' Could you post all of the details?– Derek ChowFeb 15 at 18:42
    • Just added more details with the full error message. Is it what you need to identify where pycocotools is being imported from ? Many thanks for your support.*– Frédéric CoubardFeb 16 at 7:16
    • Download the cocoapi and run the python installation steps. ``` # From PythonAPI make sudo make install ```– Derek ChowFeb 16 at 19:55
    • Does downloading the cocoapi and running the installation steps make sense if you are running in the Google ML cloud? Does cocoapi need to be included in the gcloud ml-engine jobs submit training command here?…– haydukeFeb 17 at 2:49

    I had the same problem and solved it, but unfortunately for you, I am working on Ubuntu. But hopefully this helps someone else with the same issue:

    First of all, you need to follow the steps that are described in the install guide of the object detection api. In my case though, that was not enough, I had the same problem as before. During the installation process described there, you download a github repository, specifically this one.

    What I did next was to navigate to the folder cocoapi/PythonAPI and running

    sudo python3 install

    Evaluation script seems to be working now.

    • Thanks for this report :-). Will take a look in the coming week.– Frédéric CoubardApr 20 at 5:54

    Your Answer


    By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.