Modulenotfounderror: no module named pycocotools ( Solved )

Modulenotfounderror no module named pycocotools

modulenotfounderror: no module named pycocotools error occurs because of incompatibility of pycocotools in various top layer packages (TensorFlow etc). Typically we have seen this error in object detection with TensorFlow at the evaluation stage. But there may be multiple scenarios where we can get this error. The motive to create this article is to provide a generic solution which will fit all such similar errors.

modulenotfounderror: no module named pycocotools ( Approaches to Fix ) –

There are multiple ways to fix this error but we will start with easiest.

Approach 1: Using pycocotools source code –

The source code for pycocotools resides in git. we will pull the code from there and install the same. But to incorporate this completely, It is advisable to upgrade the related packages ( scikit-image, cython) with it. Here is the command set you can try-

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

Note – It is advisable to install Install Visual C++ 2015 Build Tools along with such similar packages

Approach 2: Installation of pycocotools with pypi using pip –

Here we will use pip package manager and pull the build from pypi repository. Here is the command for the same.

pip install pycocotools

window users can also try to execute the below command-

pip install pycocotools-windows
modulenotfounderror no module named pycocotools
modulenotfounderror no module named pycocotools


Approach 3: Installation of pycocotools with conda  –

Just like pip, we can use conda package manager to install or upgrade pycocotools. Here is the command for the same.

conda install -c conda-forge pycocotools

we have used conda-forge mirror but there are other possibilities which you can use. Please refer to below

details for this.

no module named pycocotools conda fix
no module named pycocotools conda fix

These pycocotools deal with coco dataset which is generalized for object detection, image detection, and another computer vision-related task. This is mainly useful in most of the state of art algorithms in computer vision. I hope this article, will help you in fixing the above error. In case of any queries please reach out to us.


Data Science Learner Team

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Abhishek ( Chief Editor) , a data scientist with major expertise in NLP and Text Analytics. He has worked on various projects involving text data and have been able to achieve great results. He is currently manages, where he and his team share knowledge and help others learn more about data science.
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner