Modulenotfounderror: no module named pycocotools ( Solved )

Tensoflow is a deep learning framework that allows you to build a prediction model. While using it you may get the error Modulenotfounderror: no module named pycocotools.  The pycocotools is a Python API that assists in loading, parsing, and visualizing the annotations in COCO. In this entire post, you will know the various ways to solve this no module named pycocotools error.

What is ModuleNotFoundError?

ModuleNotFoundError is an error you generally get when you are trying to import a specific module in your code. The python interpreter is telling you that the specific module does not found in your system. For example, If you are importing module “A” and you are getting the error Modulenotfounderror: no module named “A” then it clears that module “A” might not be in your system.

One way to fix this issue is to install the module that you are trying to import. You can do this using the pip install command. For example, if you are trying to import module “A”, you can install it using the command “pip install A”. After installing the module, you should be able to import it without any issues.

Why Modulenotfounderror: no module named pycocotools ?

Most of the cases you are getting the no module named pycocotools error as the pycocotools module must not be installed in your system. It can also be the case when it is install but still getting the error. And it is because the python path is not set in the environment variable.

How to solve the no module named pycocotools ?

There are many ways to solve this error. Some of them are the below.

Solution 1: Install pycocotools module

The first solution is to install the pycocotools module. It will generally solve this error. To install it you have to use the pip command. Open your terminal and type the below command to install it.

Python 3. xx

pip3 install pycocotools

Python 2. xx

pip3 install pycocotools

Solution 2: Install module using easy-install

If the above solution does not work then you can install the module using easy-install. You just need to input the command easy-install pycocotools in the command prompt window. It will install so that the required software packages. If done in the right manner, you will get the message successfully installed.

Run the below command to install it.

easy-install pycocotools

Solution 3: Install from the source code

If you are unable to install the module using pip and easy-install then you can install the pycocotools module directly from the source code. The installation of pycocotools from the source code option is a little bit more complicated option than the first two installation procedures.

Users can download the source code option directly from the GitHub page which can be availed online. After downloading the source code, just unzip the folder and locate the correct location of the pycocotools software that needs to get downloaded. The unzipped folder location can be traced by inputting the command “cd path/to/folder”.

Users can type the required folder path by substituting the command “path/to/folder” with needy ones. If located in the right folder, just type python install to complete the installation procedure.

Run the command to install the module.


These are the ways you can get rid of the Modulenotfounderror: no module named pycocotools error. If you are still getting the error then you can contact us for help.

Hi, I am CodeTheBest. Here you will learn the best coding tutorials on the latest technologies like a flutter, react js, python, Julia, and many more in a single place.


This Offer is Limited! Grab your Discount!
15000 ChatGPT Prompts
Offer Expires In: