cocodataset / cocoapi

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

Can't build cocotools for python3.6 #256

Open nickyua opened 5 years ago

nickyua commented 5 years ago

I am trying to install Tensorflow object detection API using this guide: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

I have installed all dependencies and clone tensorflow/models.

Now I'm trying to build pycocotools. And got this error. I updated Xcode using this command: xcode-select --install

I use macOS Mojave , python 3.6, Tensorflow 1.11.0

python setup.py build_ext --inplace running build_ext building 'pycocotools._mask' extension cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I../common -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ../common/maskApi.c -o build/temp.macosx-10.14-intel-2.7/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99 cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I../common -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pycocotools/_mask.c -o build/temp.macosx-10.14-intel-2.7/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99 clang: error: no such file or directory: 'pycocotools/_mask.c' clang: error: no input files error: command 'cc' failed with exit status 1 make: *** [all] Error 1

Update: Solved it by changing in Makefile python->python3.6

atasoglou commented 5 years ago

same issue with python 3.7 (and the trick didn't work)

banyh commented 5 years ago

Solved it by pip install cython.

ZJU-PLP commented 5 years ago

@banyh Did you solve the problem by "pip install cython" ? Why I still have the problem after pip3.6 install cython?

panchgonzalez commented 5 years ago

Just make sure you use the correct python version in the makefile if you're using python3

all:
    # install pycocotools locally
    python3 setup.py build_ext --inplace
    rm -rf build

install:
    # install pycocotools to the Python site-packages
    python3 setup.py build_ext install
    rm -rf build
malcolmgarner-movement commented 5 years ago

@banyh This worked for me by running pip3 install cython

@ZJU-PLP try using pip3, hope this helps you out

danielmorozoff commented 4 years ago

I had the same issue building pycocotools==2.0.0 via requirements running python3.7 I got both cython and numpy error running from a fresh virtualenv

Solution: pip install cython and numpy before hand.

This fixed the setup issue