It seems the COCO PythonAPI only support python2. But peoples do use it in python3 environment.
I tried possible methods to install it, like
python3 setup.py build_ext --inplace
python3 setup.py install
But python3 setup.py install
will fail due to coco.py
and cocoeval.py
containning python2 print function.
Update: solved by updating the COCO PythonAPI project. Leave this question for people facing the same issue.
pycocotools is a Python API that. # assists in loading, parsing and visualizing the annotations in COCO.
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.
Try the following steps:
git clone https://github.com/cocodataset/cocoapi.git
2to3 . -w
. Note that you might have to install a package to get 2to3. It is an elegant tool to convert code from Python2 to Python3; this code converts all .py files from Python2-compatible to Python3-compatiblepython3 setup.py install
This should help you install COCO or any package intended for Python2, and run the package using Python3. Cheers!
I have completed it with a simple step
pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
** before that you need to install Visual C++ 2015 build tools on your path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With