Closed
Description
Thanks a lot
I am having the following error
"ImportError: No module named 'pycocotools'"
Can you please advice me how to install it as I could not find it on pip or conda?
I tried the installation from https://github.com/cocodataset/cocoapi but did not work too
Activity
Walid-Ahmed commentedon Nov 2, 2017
Solved using
https://github.com/cocodataset/cocoapi
hi-mel commentedon Nov 2, 2017
Cloning https://github.com/waleedka/coco (which is @waleedka's fork of the coco API), then running
installed pycocotools to site-packages and resolved the import error.
philferriere commentedon Nov 2, 2017
The package
pycocotools
requirescython
and a C compiler to install correctly. You can also installpycocotools
as follows:On Linux, run
pip install git+https://github.com/waleedka/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI
On Windows, run
pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI
pirahagvp commentedon Nov 3, 2017
git clone https://github.com/pdollar/coco.git
cd coco/PythonAPI
make
sudo make install
sudo python setup.py install
before doing above steps install cython
waleedka commentedon Nov 3, 2017
Updated the README file to include installation instructions for pycocotools. Thanks @philferriere
YueXiNPU commentedon Dec 16, 2017
thanks!
YerongLi commentedon Feb 12, 2018
On
sudo make install
I've got error:I am using python 3.6 and I have both cython and h5py, any ideas why this is happening??
YerongLi commentedon Feb 12, 2018
I fixed the issue above by linking python in the Makefile with my conda python:
utahman commentedon Feb 22, 2018
I fixed this way:
Chillee commentedon Mar 9, 2018
@utahman Same, but with the command
pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
raymond30031 commentedon Apr 18, 2018
Hello All,
I am using miniconda and i want to install the pycocotools to me conda environment, not my global environment
When i try to run
conda_env/bin/pip install git+https://github.com/waleedka/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI
It prompts me for username and I don't think it is asking for my username.
Does anyone know how to get around this issue?
I am avoiding make install because I am not familiar with make and I don't want to accidentally install things outside of my conda environment.
However, I am opened to suggestions if anyone can tell me how to install to conda environment using make.
--- Update ---
I tried the suggestion from @YerongLi and modified my make file to:
all:
# install pycocotools locally
/home/jkuo/miniconda3/envs/test/bin/python setup.py build_ext --inplace
rm -rf build
install:
# install pycocotools to the Python site-packages
/home/jkuo/miniconda3/envs/test/bin/python setup.py build_ext install
rm -rf build
and then i run the following commands:
make install
python setup.py install
Then I see pycocotools in my site-package:

However, I still get the ModuleNotFoundError: No module named 'pycocotools'

---Fixed---
Follow the solution of this post
run 'conda install notebook' in the env and jupyter notebook again
Thanks,
JC
kmario23 commentedon Jun 6, 2018
The solution suggested by @g-mel works like a charm in UbuntuGnome 16.04, Python 3.6 and it directly installs it to
site-packages
. Thus, no import errors are faced.waleedka commentedon Jun 6, 2018
The easiest way I found and it has worked for me on Mac, Ubuntu and Windows:
The full installation steps that I use with conda on Python 3.6 (tested this on Ubuntu 18.04 only):
sytelus commentedon Jul 7, 2018
Thanks @philferriere. The pip install hosted on github repo worked well!
47 remaining items