open-mmlab / cocoapi

COCO API - Dataset @ http://cocodataset.org/
Other
46 stars 35 forks source link

Issue while setting up cocoapi #23

Closed arushijain45 closed 3 years ago

arushijain45 commented 3 years ago

In the step: pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"

I am getting following error:

Building wheel for mmpycocotools (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /xxx/Python/miniconda3/envs/torch1.5cu101/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-zlq4o34_/pycocotools/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-zlq4o34_/pycocotools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-izl_v7fr
       cwd: /tmp/pip-req-build-zlq4o34_/pycocotools
  Complete output (63 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/pycocotools
  copying pycocotools/__init__.py -> build/lib.linux-x86_64-3.7/pycocotools
  copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-3.7/pycocotools
  copying pycocotools/coco.py -> build/lib.linux-x86_64-3.7/pycocotools
  copying pycocotools/mask.py -> build/lib.linux-x86_64-3.7/pycocotools
  running build_ext
  building 'pycocotools._mask' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/common
  creating build/temp.linux-x86_64-3.7/pycocotools
  gcc -pthread -B /xxx/Python/miniconda3/envs/torch1.5cu101/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/xxx/Python/miniconda3/envs/torch1.5cu101/lib/python3.7/site-packages/numpy/core/include -Icommon -I/xxx/Softies/Python/miniconda3/envs/torch1.5cu101/include/python3.7m -c common/maskApi.c -o build/temp.linux-x86_64-3.7/common/maskApi.o
  common/maskApi.c: In function ‘rleDecode’:
  common/maskApi.c:46:7: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
         for( k=0; k<R[i].cnts[j]; k++ ) *(M++)=v; v=!v; }}
         ^~~
  common/maskApi.c:46:49: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
         for( k=0; k<R[i].cnts[j]; k++ ) *(M++)=v; v=!v; }}
                                                   ^
  common/maskApi.c: In function ‘rleFrPoly’:
  common/maskApi.c:166:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
     for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
     ^~~
  common/maskApi.c:166:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
     for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
                                                        ^
  common/maskApi.c:167:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
     for(j=0; j<k; j++) y[j]=(int)(scale*xy[j*2+1]+.5); y[k]=y[0];
     ^~~
  common/maskApi.c:167:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
     for(j=0; j<k; j++) y[j]=(int)(scale*xy[j*2+1]+.5); y[k]=y[0];
                                                        ^
  common/maskApi.c: In function ‘rleToString’:
  common/maskApi.c:212:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
         if(more) c |= 0x20; c+=48; s[p++]=c;
         ^~
  common/maskApi.c:212:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
         if(more) c |= 0x20; c+=48; s[p++]=c;
                             ^
  common/maskApi.c: In function ‘rleFrString’:
  common/maskApi.c:220:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
     while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
     ^~~~~
  common/maskApi.c:220:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
     while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
                        ^~~~
  common/maskApi.c:228:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
       ^~
  common/maskApi.c:228:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
       if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
                                    ^~~~
  common/maskApi.c: In function ‘rleToBbox’:
  common/maskApi.c:141:31: warning: ‘xp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         if(j%2==0) xp=x; else if(xp<x) { ys=0; ye=h-1; }
                                 ^
  gcc -pthread -B /xxx/Softies/Python/miniconda3/envs/torch1.5cu101/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/xxx/Softies/Python/miniconda3/envs/torch1.5cu101/lib/python3.7/site-packages/numpy/core/include -Icommon -I/xxx/Softies/Python/miniconda3/envs/torch1.5cu101/include/python3.7m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.7/pycocotools/_mask.o
  gcc: error: pycocotools/_mask.c: No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for mmpycocotools

Environment:

certifi==2020.11.8 cycler==0.10.0 Cython==0.29.21 future==0.18.2 kiwisolver==1.3.1 matplotlib==3.3.3 mkl-fft==1.2.0 mkl-random==1.1.1 mkl-service==2.3.0 mmcv==0.5.4 mmpycocotools==12.0.3 numpy @ file:///tmp/build/80754af9/numpy_and_numpy_base_1603479632437/work olefile==0.46 opencv-python==4.4.0.46 Pillow==6.2.2 pyparsing==2.4.7 python-dateutil==2.8.1 six @ file:///tmp/build/80754af9/six_1605205313296/work terminaltables==3.1.0 torch==1.5.1 torchvision==0.6.0a0+35d732a

arushijain45 commented 3 years ago

I resolved this issue after installing mmcv-full with legacy-resolver for pip. Then installed pycocotools, its correctly installed.

Commands used:

pip install mmcv-full==latest+torch1.6.0+cu101 -f https://download.openmmlab.com/mmcv/dist/index.html --use-deprecated=legacy-resolver
pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"

Environment:

addict==2.4.0
certifi==2020.11.8
cycler==0.10.0
Cython==0.29.21
future==0.18.2
kiwisolver==1.3.1
matplotlib==3.3.3
mkl-fft==1.2.0
mkl-random==1.1.1
mkl-service==2.3.0
mmcv-full==1.2.1
mmpycocotools @ git+https://github.com/open-mmlab/cocoapi.git@01f805cd54d7bd7af64c0fbd5fd96d8ca0b9ddc9#subdirectory=pycocotools
numpy @ file:///tmp/build/80754af9/numpy_and_numpy_base_1603479632437/work
olefile==0.46
opencv-python==4.4.0.46
Pillow==6.2.2
pyparsing==2.4.7
python-dateutil==2.8.1
PyYAML==5.3.1
six @ file:///tmp/build/80754af9/six_1605205313296/work
terminaltables==3.1.0
torch==1.6.0
torchvision==0.7.0
yapf==0.30.0