Xianpeng919 / MonoCon

Learning Auxiliary Monocular Contexts Helps Monocular 3D Object Detection (AAAI'22)
146 stars 23 forks source link

pip install mmpycocotools: "gcc: error: ../common/maskApi.c: No such file or directory" #32

Closed utkutpcgl closed 8 months ago

utkutpcgl commented 8 months ago

Problem:

I was trying to install mmpycocotools, where my cython version was 3.0.7. I got this error:

(base) root@dfc48a1e70aa:/raid/home_yedek/utku/MonoCon/mmdetection3d-0.14.0# pip install mmpycocotools
Collecting mmpycocotools
  Using cached mmpycocotools-12.0.3.tar.gz (23 kB)
Requirement already satisfied: setuptools>=18.0 in /opt/conda/lib/python3.7/site-packages (from mmpycocotools) (46.4.0.post20200518)
Requirement already satisfied: cython>=0.27.3 in /opt/conda/lib/python3.7/site-packages (from mmpycocotools) (3.0.7)
Requirement already satisfied: matplotlib>=2.1.0 in /opt/conda/lib/python3.7/site-packages (from mmpycocotools) (3.5.3)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/conda/lib/python3.7/site-packages (from matplotlib>=2.1.0->mmpycocotools) (1.4.5)
Requirement already satisfied: cycler>=0.10 in /opt/conda/lib/python3.7/site-packages (from matplotlib>=2.1.0->mmpycocotools) (0.11.0)
Requirement already satisfied: python-dateutil>=2.7 in /opt/conda/lib/python3.7/site-packages (from matplotlib>=2.1.0->mmpycocotools) (2.8.2)
Requirement already satisfied: packaging>=20.0 in /opt/conda/lib/python3.7/site-packages (from matplotlib>=2.1.0->mmpycocotools) (23.2)
Requirement already satisfied: pillow>=6.2.0 in /opt/conda/lib/python3.7/site-packages (from matplotlib>=2.1.0->mmpycocotools) (7.1.2)
Requirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.7/site-packages (from matplotlib>=2.1.0->mmpycocotools) (1.18.1)
Requirement already satisfied: fonttools>=4.22.0 in /opt/conda/lib/python3.7/site-packages (from matplotlib>=2.1.0->mmpycocotools) (4.38.0)
Requirement already satisfied: pyparsing>=2.2.1 in /opt/conda/lib/python3.7/site-packages (from matplotlib>=2.1.0->mmpycocotools) (3.1.1)
Requirement already satisfied: typing-extensions; python_version < "3.8" in /opt/conda/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib>=2.1.0->mmpycocotools) (4.7.1)
Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.7/site-packages (from python-dateutil>=2.7->matplotlib>=2.1.0->mmpycocotools) (1.14.0)
Building wheels for collected packages: mmpycocotools
  Building wheel for mmpycocotools (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/conda/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h5eil3tu/mmpycocotools/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h5eil3tu/mmpycocotools/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-gfprdl92
       cwd: /tmp/pip-install-h5eil3tu/mmpycocotools/
  Complete output (76 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/coco.py -> build/lib.linux-x86_64-3.7/pycocotools
  copying pycocotools/mask.py -> build/lib.linux-x86_64-3.7/pycocotools
  copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-3.7/pycocotools
  running build_ext
  Compiling pycocotools/_mask.pyx because it changed.
  [1/1] Cythonizing pycocotools/_mask.pyx
  /opt/conda/lib/python3.7/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-h5eil3tu/mmpycocotools/pycocotools/_mask.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'pycocotools._mask' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/pycocotools
  creating build/temp.linux-x86_64-3.7/common
  creating build/common
  gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.7/site-packages/numpy/core/include -Icommon -I/opt/conda/include/python3.7m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.7/pycocotools/_mask.o
  In file included from /opt/conda/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
                   from /opt/conda/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                   from /opt/conda/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from pycocotools/_mask.c:1219:
  /opt/conda/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   #warning "Using deprecated NumPy API, disable it with " \
    ^~~~~~~
  gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.7/site-packages/numpy/core/include -Icommon -I/opt/conda/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 /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.7/site-packages/numpy/core/include -Icommon -I/opt/conda/include/python3.7m -c ../common/maskApi.c -o build/temp.linux-x86_64-3.7/../common/maskApi.o
  gcc: error: ../common/maskApi.c: No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for mmpycocotools
  Running setup.py clean for mmpycocotools
Failed to build mmpycocotools
Installing collected packages: mmpycocotools
    Running setup.py install for mmpycocotools ... error
    ERROR: Command errored out with exit status 1:
     command: /opt/conda/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h5eil3tu/mmpycocotools/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h5eil3tu/mmpycocotools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vq8q1ge5/install-record.txt --single-version-externally-managed --compile --install-headers /opt/conda/include/python3.7m/mmpycocotools
         cwd: /tmp/pip-install-h5eil3tu/mmpycocotools/
    Complete output (70 lines):
    running install
    running build
    running build_py
    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/coco.py -> build/lib.linux-x86_64-3.7/pycocotools
    copying pycocotools/mask.py -> build/lib.linux-x86_64-3.7/pycocotools
    copying pycocotools/cocoeval.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/pycocotools
    creating build/temp.linux-x86_64-3.7/common
    gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.7/site-packages/numpy/core/include -Icommon -I/opt/conda/include/python3.7m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.7/pycocotools/_mask.o
    In file included from /opt/conda/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
                     from /opt/conda/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                     from /opt/conda/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from pycocotools/_mask.c:1219:
    /opt/conda/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it with " \
      ^~~~~~~
    gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.7/site-packages/numpy/core/include -Icommon -I/opt/conda/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 /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.7/site-packages/numpy/core/include -Icommon -I/opt/conda/include/python3.7m -c ../common/maskApi.c -o build/temp.linux-x86_64-3.7/../common/maskApi.o
    gcc: error: ../common/maskApi.c: No such file or directory
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /opt/conda/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h5eil3tu/mmpycocotools/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h5eil3tu/mmpycocotools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vq8q1ge5/install-record.txt --single-version-externally-managed --compile --install-headers /opt/conda/include/python3.7m/mmpycocotools Check the logs for full command output.`

Solution:

Downgrading cython to 0.29.37 solved this issue.