ifzhang / FairMOT

[IJCV-2021] FairMOT: On the Fairness of Detection and Re-Identification in Multi-Object Tracking
MIT License
4.03k stars 934 forks source link

Cython_bbox and lap installation error #486

Closed fatbringer closed 2 years ago

fatbringer commented 2 years ago

Hello there, i am not sure if anyone has ever encountered this error

rc/cython_bbox.c:31:10: fatal error: Python.h: No such file or directory
     31 | #include "Python.h"
        |          ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for cython-bbox
  Running setup.py clean for cython-bbox
  Building wheel for lap (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/aevas/Desktop/pyenvs/fairmotpy39/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dweujmo4/lap_14d06a4a011f45a69d78f1a214bd5715/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dweujmo4/lap_14d06a4a011f45a69d78f1a214bd5715/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-pzh48d16
       cwd: /tmp/pip-install-dweujmo4/lap_14d06a4a011f45a69d78f1a214bd5715/
  Complete output (34 lines):
  Partial import of lap during the build process.
  Generating cython files
  running bdist_wheel
  running build
  running config_cc
  running config_fc
  running build_src

SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/lap
  copying lap/lapmod.py -> build/lib.linux-x86_64-3.9/lap
  copying lap/__init__.py -> build/lib.linux-x86_64-3.9/lap
  running build_ext
  creating /tmp/tmpijpimqcg/home
  creating /tmp/tmpijpimqcg/home/aevas
  creating /tmp/tmpijpimqcg/home/aevas/Desktop
  creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs
  creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39
  creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib
  creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9
  creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages
  creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy
  creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/distutils
  creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/distutils/checks
  CCompilerOpt.generate_dispatch_header[2281] : dispatch header dir build/src.linux-x86_64-3.9/numpy/distutils/include does not exist, creating it
  creating build/temp.linux-x86_64-3.9/lap
  lap/_lapjv.cpp:4:10: fatal error: Python.h: No such file or directory
      4 | #include "Python.h"
        |          ^~~~~~~~~~
  compilation terminated.
  error: Command "x86_64-linux-gnu-g++ -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/core/include -Ilap -I/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.9/numpy/distutils/include -I/home/aevas/Desktop/pyenvs/fairmotpy39/include -I/usr/include/python3.9 -c lap/_lapjv.cpp -o build/temp.linux-x86_64-3.9/lap/_lapjv.o -MMD -MF build/temp.linux-x86_64-3.9/lap/_lapjv.o.d -msse -msse2 -msse3" failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for lap

  Running setup.py install for lap ... error
    ERROR: Command errored out with exit status 1:

 warnings.warn(
    running build
    running config_cc
    running config_fc
    running build_src
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/lap
    copying lap/lapmod.py -> build/lib.linux-x86_64-3.9/lap
    copying lap/__init__.py -> build/lib.linux-x86_64-3.9/lap
    running build_ext
    creating /tmp/tmplmbzif7h/home
    creating /tmp/tmplmbzif7h/home/aevas
    creating /tmp/tmplmbzif7h/home/aevas/Desktop
    creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs
    creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39
    creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib
    creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9
    creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages
    creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy
    creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/distutils
    creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/distutils/checks
    CCompilerOpt.generate_dispatch_header[2281] : dispatch header dir build/src.linux-x86_64-3.9/numpy/distutils/include does not exist, creating it
    creating build/temp.linux-x86_64-3.9/lap
    lap/_lapjv.cpp:4:10: fatal error: Python.h: No such file or directory
        4 | #include "Python.h"
          |          ^~~~~~~~~~
    compilation terminated.
    error: Command "x86_64-linux-gnu-g++ -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/core/include -Ilap -I/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.9/numpy/distutils/include -I/home/aevas/Desktop/pyenvs/fairmotpy39/include -I/usr/include/python3.9 -c lap/_lapjv.cpp -o build/temp.linux-x86_64-3.9/lap/_lapjv.o -MMD -MF build/temp.linux-x86_64-3.9/lap/_lapjv.o.d -msse -msse2 -msse3" failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1:

I have created a new virtual envrionment before installing.

fatbringer commented 2 years ago

I was installing it in a brand new virtual environment running python3.9. I am not using any conda environment. Here are my system specs, if required

11th Gen Intel® Core™ i7-11850H @ 2.50GHz × 16 llvmpipe (LLVM 12.0.0, 256 bits) / Mesa Intel® UHD Graphics (TGL GT1) Ubuntu 21.04 64-bit

fatbringer commented 2 years ago

Solution: https://stackoverflow.com/questions/70516037/cython-bbox-and-lap-installation-error-include-python-h-not-found

sudo apt install libpython3.9-dev

Aparajit-Garg commented 2 years ago

I was also having problem installing cython_bbox, the solution that worked for me was pip install cython and then pip install cython_bbox. Hope it helps.