jin-s13 / xtcocoapi

Extended COCO-API
Other
63 stars 24 forks source link

Install on Mac M1 fails #35

Closed bossebandowski closed 1 year ago

bossebandowski commented 1 year ago

Command run:

pip install xtcocotools

Expected output: install without errors and outputs

Actual output: Installation failure with the following backtrace

[...]
Building wheels for collected packages: xtcocotools
  Building wheel for xtcocotools (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [35 lines of output]
      [my_venv]/lib/python3.10/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-310
      creating build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/coco.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/mask.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/version.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/__init__.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      copying xtcocotools/cocoeval.py -> build/lib.macosx-13-arm64-cpython-310/xtcocotools
      running build_ext
      Compiling xtcocotools/_mask.pyx because it changed.
      [1/1] Cythonizing xtcocotools/_mask.pyx
      [my_venv]/lib/python3.10/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: /Users/bob/sandbox/dwpose/xtcocoapi/xtcocotools/_mask.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      building 'xtcocotools._mask' extension
      creating build/common
      creating build/temp.macosx-13-arm64-cpython-310
      creating build/temp.macosx-13-arm64-cpython-310/common
      creating build/temp.macosx-13-arm64-cpython-310/xtcocotools
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I[my_venv]/lib/python3.10/site-packages/numpy/core/include -I./common -I[my_venv]/include -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c ../common/maskApi.c -o build/temp.macosx-13-arm64-cpython-310/../common/maskApi.o
      clang: error: no such file or directory: '../common/maskApi.c'
      clang: error: no input files
      error: command '/usr/bin/clang' 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 xtcocotools
  Running setup.py clean for xtcocotools
Failed to build xtcocotools

Let's ignore the warnings due to updated setuptools and missing cython flags and focus on the actual error here. During install, xtcocotools/_mask.pyx is recompiled because it has allegedly changed. In the file header, we have a comment that points distutils to ../common/maskApi.c which is not found because it exists in the relative path ./common/maskApi.c to the root folder where we install from. Fixing the path resolved the install problem. I'll add a PR with the fix that solved my problem which you may or may not merge at your convenience.

hjessmith commented 1 year ago

Thank you so much for the fix, @bossebandowski. This issue broke my Animated Drawings repo. It would have taken me a very long time to figure this out.

jin-s13 commented 1 year ago

Thanks for the report. The fix is merged.