0

I am trying to install pycocoevalcap with

pip install pycocoevalcap

While it is installing pycocotools following error occurs which does not happen normally: LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG

Collecting pycocoevalcap
  Using cached pycocoevalcap-1.2-py3-none-any.whl (104.3 MB)
Collecting pycocotools>=2.0.2
  Using cached pycocotools-2.0.5.tar.gz (24 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting matplotlib>=2.1.0
  Using cached matplotlib-3.6.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (9.4 MB)
Requirement already satisfied: numpy in /home/tealy/miniconda3/envs/torch_source/lib/python3.8/site-packages (from pycocotools>=2.0.2->pycocoevalcap) (1.23.1)
Requirement already satisfied: pillow>=6.2.0 in /home/tealy/miniconda3/envs/torch_source/lib/python3.8/site-packages/Pillow-9.2.0-py3.8-linux-x86_64.egg (from matplotlib>=2.1.0->pycocotools>=2.0.2->pycocoevalcap) (9.2.0)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.4.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.2 MB)
Collecting contourpy>=1.0.1
  Using cached contourpy-1.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (295 kB)
Requirement already satisfied: packaging>=20.0 in /home/tealy/miniconda3/envs/torch_source/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools>=2.0.2->pycocoevalcap) (21.3)
Collecting cycler>=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Requirement already satisfied: pyparsing>=2.2.1 in /home/tealy/miniconda3/envs/torch_source/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools>=2.0.2->pycocoevalcap) (3.0.9)
Collecting python-dateutil>=2.7
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting fonttools>=4.22.0
  Using cached fonttools-4.37.4-py3-none-any.whl (960 kB)
Requirement already satisfied: six>=1.5 in /home/tealy/miniconda3/envs/torch_source/lib/python3.8/site-packages (from python-dateutil>=2.7->matplotlib>=2.1.0->pycocotools>=2.0.2->pycocoevalcap) (1.16.0)
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pycocotools (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [73 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/pycocotools
      copying pycocotools/__init__.py -> build/lib.linux-x86_64-cpython-38/pycocotools
      copying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-38/pycocotools
      copying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-38/pycocotools
      copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-38/pycocotools
      running build_ext
      cythoning pycocotools/_mask.pyx to pycocotools/_mask.c
      building 'pycocotools._mask' extension
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/common
      creating build/temp.linux-x86_64-cpython-38/pycocotools
      gcc -pthread -B /home/tealy/miniconda3/envs/torch_source/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-env-n0y9b3vp/overlay/lib/python3.8/site-packages/numpy/core/include -I./common -I/home/tealy/miniconda3/envs/torch_source/include/python3.8 -c ./common/maskApi.c -o build/temp.linux-x86_64-cpython-38/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
      ./common/maskApi.c: In function 'rleToBbox':
      ./common/maskApi.c:151:32: warning: unused variable 'xp' [-Wunused-variable]
        151 |     uint h, w, xs, ys, xe, ye, xp, cc; siz j, m;
            |                                ^~
      ./common/maskApi.c: In function 'rleFrPoly':
      ./common/maskApi.c:197:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
        197 |   for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
            |   ^~~
      ./common/maskApi.c:197:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
        197 |   for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
            |                                                      ^
      ./common/maskApi.c:198:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
        198 |   for(j=0; j<k; j++) y[j]=(int)(scale*xy[j*2+1]+.5); y[k]=y[0];
            |   ^~~
      ./common/maskApi.c:198:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
        198 |   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:243:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
        243 |       if(more) c |= 0x20; c+=48; s[p++]=c;
            |       ^~
      ./common/maskApi.c:243:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
        243 |       if(more) c |= 0x20; c+=48; s[p++]=c;
            |                           ^
      ./common/maskApi.c: In function 'rleFrString':
      ./common/maskApi.c:251:3: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
        251 |   while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
            |   ^~~~~
      ./common/maskApi.c:251:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
        251 |   while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
            |                      ^~~~
      ./common/maskApi.c:259:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
        259 |     if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
            |     ^~
      ./common/maskApi.c:259:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
        259 |     if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
            |                                  ^~~~
      gcc -pthread -B /home/tealy/miniconda3/envs/torch_source/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-env-n0y9b3vp/overlay/lib/python3.8/site-packages/numpy/core/include -I./common -I/home/tealy/miniconda3/envs/torch_source/include/python3.8 -c pycocotools/_mask.c -o build/temp.linux-x86_64-cpython-38/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
      pycocotools/_mask.c: In function '__pyx_pf_11pycocotools_5_mask_12iou':
      pycocotools/_mask.c:6154:31: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'siz' {aka 'long unsigned int'} [-Wsign-compare]
       6154 |     if (unlikely(!((__pyx_t_8 == __pyx_v_n) != 0))) {
            |                               ^~
      pycocotools/_mask.c:938:43: note: in definition of macro 'unlikely'
        938 |   #define unlikely(x) __builtin_expect(!!(x), 0)
            |                                           ^
      pycocotools/_mask.c: In function '__Pyx_Import':
      pycocotools/_mask.c:15349:21: warning: the comparison will always evaluate as 'true' for the pointer operand in '(char *)"pycocotools._mask" + 11' must not be NULL [-Waddress]
      15349 |             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
            |                     ^~
      gcc -pthread -shared -B /home/tealy/miniconda3/envs/torch_source/compiler_compat -L/home/tealy/miniconda3/envs/torch_source/lib -Wl,-rpath=/home/tealy/miniconda3/envs/torch_source/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-38/./common/maskApi.o build/temp.linux-x86_64-cpython-38/pycocotools/_mask.o -o build/lib.linux-x86_64-cpython-38/pycocotools/_mask.cpython-38-x86_64-linux-gnu.so
      /home/tealy/miniconda3/envs/torch_source/compiler_compat/ld: cannot find /lib64/libpthread.so.0
      /home/tealy/miniconda3/envs/torch_source/compiler_compat/ld: cannot find /usr/lib64/libpthread_nonshared.a
      collect2: error: ld returned 1 exit status
      /tmp/pip-build-env-n0y9b3vp/overlay/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-cagq1h_3/pycocotools_1d294175c50248669a6c60efc0a0cf40/pycocotools/_mask.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      error: command '/home/tealy/miniconda3/envs/torch_source/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG LOG

tealy
  • 132
  • 1
  • 12
  • may be you want to install this required first pyproject.toml-based projects – Henro Sutrisno Tanjung Oct 04 '22 at 09:57
  • I am sorry, i didn't understand. What do you mean by required? – tealy Oct 04 '22 at 10:01
  • i mean before you install pip install pycocoevalcap, try to install pyproject.toml-based. with this command : pip install pyproject-toml – Henro Sutrisno Tanjung Oct 04 '22 at 10:03
  • 1
    @tealy Don't listen to bad advice, there're more than enough of them at SO. There is no such project `pyproject.toml-based`, you cannot install it. "pyproject.toml-based" means that [`pycocotools` uses `pyproject.toml`](https://github.com/ppwwyyxx/cocoapi/blob/142d746f67a42502a82353bf7d74e55485955601/PythonAPI/pyproject.toml) build description file so `pip` has special considerations for it. – phd Oct 04 '22 at 11:09
  • 1
    To install `pycocotools` try `conda install pycocotools -c conda-forge`. See https://stackoverflow.com/a/70873037/7976758 Found in https://stackoverflow.com/questions/tagged/pip+pycocotools – phd Oct 04 '22 at 11:11
  • Thank you @phd your solution works if you answer i can accept it. – tealy Oct 04 '22 at 14:09

0 Answers0