cocodataset / cocoapi

COCO API - Dataset @ http://cocodataset.org/
Other
6.07k stars 3.75k forks source link

install issue related to building #170

Open glw opened 6 years ago

glw commented 6 years ago

Im using coco evaluation after training with tensorflow object detection api. OS: Ubuntu 16 Python3

I saw the issues for installing cocoapi using python3.

I now have pycocotools installed under Python3.

running python3 object_detection/eval.py ... still gave me errors.

ImportError: No module named 'pycocotools._mask'

I went back to cocoapi. Assuming I missed something in the installation.

When running python setup command instead of make within the cocoapi/PythonAPI, it does not complete successfully. I get error

python3 setup.py build_ext install
running build_ext
skipping 'pycocotools/_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I../common -I/usr/include/python3.5m -c ../common/maskApi.c -o build/temp.linux-x86_64-3.5/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

And when running

python3 setup.py build_ext --inplace
running build_ext
skipping 'pycocotools/_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I../common -I/usr/include/python3.5m -c ../common/maskApi.c -o build/temp.linux-x86_64-3.5/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Im not sure where to go from here... Appears to be related to Cython but that is installed at version 0.28.3. I also check to see if gcc is installed just in case and it is.

glw commented 6 years ago

I have fixed the build issue. First I tried: apt-get install libssl-dev python3-dev That didnt suffice. Then, apt-get install build-essential libffi-dev

Finally, python3 setup.py build_ext --inplace and python3 setup.py build_ext install worked.

But I am still getting an error when running.

/tensorflow/models/research# python3 object_detection/eval.py --logtostderr --pipeline_config_path=/home/obj_det/all_images/train/ssdlite_mobilenet_v2_coco.config --checkpoint_dir=/home/obj_det/all_images/train/ --eval_dir=/home/obj_det/eval
Traceback (most recent call last):
  File "object_detection/eval.py", line 50, in <module>
    from object_detection import evaluator
  File "/tensorflow/models/research/object_detection/evaluator.py", line 24, in <module>
    from object_detection import eval_util
  File "/tensorflow/models/research/object_detection/eval_util.py", line 28, in <module>
    from object_detection.metrics import coco_evaluation
  File "/tensorflow/models/research/object_detection/metrics/coco_evaluation.py", line 20, in <module>
    from object_detection.metrics import coco_tools
  File "/tensorflow/models/research/object_detection/metrics/coco_tools.py", line 47, in <module>
    from pycocotools import coco
  File "/tensorflow/models/research/pycocotools/coco.py", line 55, in <module>
    from . import mask as maskUtils
  File "/tensorflow/models/research/pycocotools/mask.py", line 3, in <module>
    import pycocotools._mask as _mask
ImportError: No module named 'pycocotools._mask'
salihkaragoz commented 6 years ago

Which python version do you use ? Python3.6 or python3.5 Try these python3 -m pip install cython python3 -m pip install pycocotools

Or

pip3 install cython pip3 install pycocotools

glw commented 6 years ago

@salihkaragoz Im using 3.5.2

Just tried the installs you suggested, and its telling me the requirement is already satisfied for both.

zacharymostowsky commented 6 years ago

@glw any development on this issue? Having similar difficulties on uBuntu 16.04 python 2.7.

eniolasonowo commented 4 years ago

install gcc and g++ all their dependencies then run pip3 install pycocotools or python3 -m pip install pycocotools , but make sure u install cython first.

cojerman commented 4 years ago

for me using python3 pip3 install cython then 'make' in coco/cocoapi/PythonAPI followed by sudo python setup.py install solved the problem