Question: I'm trying to train Mask-R CNN model from cocoapi(<https://github.com/cocodataset/cocoapi>), and this error code keep come out.

```
    ModuleNotFoundError                       Traceback (most recent call last)
    <ipython-input-8-83356bb9cf95> in <module>
         19 sys.path.append(os.path.join(ROOT_DIR, "samples/coco/"))  # To find local version
         20 
    ---> 21 from pycocotools.coco import coco
         22 
         23 get_ipython().run_line_magic('matplotlib', 'inline ')

~/Desktop/coco/PythonAPI/pycocotools/coco.py in <module>
     53 import copy
     54 import itertools
---> 55 from . import mask as maskUtils
     56 import os
     57 from collections import defaultdict

~/Desktop/coco/PythonAPI/pycocotools/mask.py in <module>
      1 __author__ = 'tsungyi'
      2 
----> 3 import pycocotools._mask as _mask
      4 
      5 # Interface for manipulating masks stored in RLE format.

ModuleNotFoundError: No module named 'pycocotools._mask'

```

I tried all the methods on the github 'issues' tab, but it is not working to me at all. Is there are another solution for this? I'm using Python 3.6, Linux.

Answer: 
The answer is summarise from [these](https://github.com/cocodataset/cocoapi/issues/172) [three](https://github.com/cocodataset/cocoapi/issues/168) [GitHub issues](https://github.com/cocodataset/cocoapi/issues/141#issuecomment-386606299)

1.whether you have installed cython in the correct version. Namely, you should install cython for python2/3 if you use python2/3

```
pip install cython

```

2.whether you have downloaded the whole .zip file from this github project. Namely, you should download all the things here even though you only need PythonAPI

```
git clone https://github.com/cocodataset/cocoapi.git

```

or

unzip the [zip file](https://github.com/cocodataset/cocoapi/archive/refs/heads/master.zip)

3.whether you open Terminal and run "make" under the correct folder. The correct folder is the one that "Makefile" is located in

```
cd path/to/coco/PythonAPI/Makefile
make

```

Almost, the question can be solved.

If not, 4 and 5 may help.

4.whether you have already installed gcc in the correct version

5.whether you have already installed python-dev in the correct version. Namely you should install python3-dev (you may try "sudo apt-get install python3-dev"), if you use python3.
Try cloning official repo and run below commands

```
python setup.py install
make

```