cvg / DeepLSD

Implementation of the paper "DeepLSD: Line Segment Detection and Refinement with Deep Image Gradients"
MIT License
487 stars 62 forks source link

Quickstart install failure - ERROR: Failed building wheel for pytlsd #30

Closed ogencoglu closed 1 year ago

ogencoglu commented 1 year ago

Following your readme

git clone --recurse-submodules https://github.com/cvg/DeepLSD.git

and

bash quickstart_install.sh

getting the following logs on Mac M2, in virtual environment:

Building wheels for collected packages: pytlsd
  Building wheel for pytlsd (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pytlsd (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [156 lines of output]
      running bdist_wheel
      running build
      running build_ext
      CMake Deprecation Warning at pybind11/CMakeLists.txt:8 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.

      -- pybind11 v2.6.2
      CMake Warning (dev) at pybind11/tools/FindPythonLibsNew.cmake:98 (find_package):
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning.

      Call Stack (most recent call first):
        pybind11/tools/pybind11Tools.cmake:45 (find_package)
        pybind11/tools/pybind11Common.cmake:201 (include)
        pybind11/CMakeLists.txt:188 (include)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      --     OpenCV_DIR: /opt/homebrew/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /opt/homebrew/Cellar/opencv/4.8.1_1/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_highguiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_alphamatopencv_arucoopencv_bgsegmopencv_bioinspiredopencv_ccalibopencv_datasetsopencv_dnn_objdetectopencv_dnn_superresopencv_dpmopencv_faceopencv_freetypeopencv_fuzzyopencv_hfsopencv_img_hashopencv_intensity_transformopencv_line_descriptoropencv_mccopencv_optflowopencv_phase_unwrappingopencv_plotopencv_qualityopencv_rapidopencv_regopencv_rgbdopencv_saliencyopencv_sfmopencv_shapeopencv_stereoopencv_structured_lightopencv_superresopencv_surface_matchingopencv_textopencv_trackingopencv_videostabopencv_vizopencv_wechat_qrcodeopencv_xfeatures2dopencv_ximgprocopencv_xobjdetectopencv_xphoto
      --     OpenCV_DIR: /opt/homebrew/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /opt/homebrew/Cellar/opencv/4.8.1_1/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_highguiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_alphamatopencv_arucoopencv_bgsegmopencv_bioinspiredopencv_ccalibopencv_datasetsopencv_dnn_objdetectopencv_dnn_superresopencv_dpmopencv_faceopencv_freetypeopencv_fuzzyopencv_hfsopencv_img_hashopencv_intensity_transformopencv_line_descriptoropencv_mccopencv_optflowopencv_phase_unwrappingopencv_plotopencv_qualityopencv_rapidopencv_regopencv_rgbdopencv_saliencyopencv_sfmopencv_shapeopencv_stereoopencv_structured_lightopencv_superresopencv_surface_matchingopencv_textopencv_trackingopencv_videostabopencv_vizopencv_wechat_qrcodeopencv_xfeatures2dopencv_ximgprocopencv_xobjdetectopencv_xphotoopencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_highguiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_alphamatopencv_arucoopencv_bgsegmopencv_bioinspiredopencv_ccalibopencv_datasetsopencv_dnn_objdetectopencv_dnn_superresopencv_dpmopencv_faceopencv_freetypeopencv_fuzzyopencv_hfsopencv_img_hashopencv_intensity_transformopencv_line_descriptoropencv_mccopencv_optflowopencv_phase_unwrappingopencv_plotopencv_qualityopencv_rapidopencv_regopencv_rgbdopencv_saliencyopencv_sfmopencv_shapeopencv_stereoopencv_structured_lightopencv_superresopencv_surface_matchingopencv_textopencv_trackingopencv_videostabopencv_vizopencv_wechat_qrcodeopencv_xfeatures2dopencv_ximgprocopencv_xobjdetectopencv_xphoto
      -- Configuring done (0.1s)
      -- Generating done (0.0s)
      -- Build files have been written to: /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/build/temp.macosx-14-arm64-cpython-311
      [ 16%] Linking CXX static library libtlsd.a
      [ 33%] Built target tlsd
      [ 50%] Building CXX object CMakeFiles/pytlsd.dir/src/PYAPI.cpp.o
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:45:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/attr.h:13:
      /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/cast.h:446:36: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                      "  " + handle(frame->f_code->co_filename).cast<std::string>() +
                                         ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:45:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/attr.h:13:
      /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/cast.h:448:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                      handle(frame->f_code->co_name).cast<std::string>() + "\n";
                                  ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:45:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/attr.h:13:
      /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/cast.h:449:26: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                  frame = frame->f_back;
                               ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2291:49: error: no member named 'frame' in '_ts'
          PyFrameObject *frame = PyThreadState_Get()->frame;
                                 ~~~~~~~~~~~~~~~~~~~  ^
      /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2292:41: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
          if (frame && (std::string) str(frame->f_code->co_name) == name &&
                                              ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2293:14: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
              frame->f_code->co_argcount > 0) {
                   ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2296:18: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                  frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                       ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      /Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2296:52: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                  frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                                                         ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      8 errors generated.
      make[2]: *** [CMakeFiles/pytlsd.dir/src/PYAPI.cpp.o] Error 1
      make[1]: *** [CMakeFiles/pytlsd.dir/all] Error 2
      make: *** [all] Error 2
      Traceback (most recent call last):
        File "/Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/ouz/Desktop/deepLSD/DeepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 434, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 419, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 65, in <module>
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-aq86ggs1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 58, in build_extension
        File "/opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pytlsd
Failed to build pytlsd

cmake --version returns cmake version 3.27.4 so that is not an issue.

Any tips would be appreciated.

rpautrat commented 1 year ago

Hi, yes the policy mentioned in the error message is not supported by CMake 3.27 and above (see https://cmake.org/cmake/help/latest/policy/CMP0148.html). I think this has been fixed in the latest version of pybind11. I have updated the submodule for pybind11 now.

Can you try again with the updated version and let me know if it solves the issue?

ogencoglu commented 1 year ago

I got the same error unfortunately:

Building wheels for collected packages: pytlsd
  Building wheel for pytlsd (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pytlsd (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [175 lines of output]
      running bdist_wheel
      running build
      running build_ext
      -- The C compiler identification is AppleClang 15.0.0.15000040
      -- The CXX compiler identification is AppleClang 15.0.0.15000040
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      CMake Deprecation Warning at pybind11/CMakeLists.txt:8 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.

      -- pybind11 v2.6.2
      CMake Warning (dev) at pybind11/tools/FindPythonLibsNew.cmake:98 (find_package):
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning.

      Call Stack (most recent call first):
        pybind11/tools/pybind11Tools.cmake:45 (find_package)
        pybind11/tools/pybind11Common.cmake:201 (include)
        pybind11/CMakeLists.txt:188 (include)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- Found PythonInterp: /Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/bin/python3.11 (found version "3.11.6")
      -- Found PythonLibs: /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      -- Performing Test HAS_FLTO_THIN
      -- Performing Test HAS_FLTO_THIN - Success
      --     OpenCV_DIR: /opt/homebrew/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /opt/homebrew/Cellar/opencv/4.8.1_1/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_highguiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_alphamatopencv_arucoopencv_bgsegmopencv_bioinspiredopencv_ccalibopencv_datasetsopencv_dnn_objdetectopencv_dnn_superresopencv_dpmopencv_faceopencv_freetypeopencv_fuzzyopencv_hfsopencv_img_hashopencv_intensity_transformopencv_line_descriptoropencv_mccopencv_optflowopencv_phase_unwrappingopencv_plotopencv_qualityopencv_rapidopencv_regopencv_rgbdopencv_saliencyopencv_sfmopencv_shapeopencv_stereoopencv_structured_lightopencv_superresopencv_surface_matchingopencv_textopencv_trackingopencv_videostabopencv_vizopencv_wechat_qrcodeopencv_xfeatures2dopencv_ximgprocopencv_xobjdetectopencv_xphoto
      --     OpenCV_DIR: /opt/homebrew/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /opt/homebrew/Cellar/opencv/4.8.1_1/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_highguiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_alphamatopencv_arucoopencv_bgsegmopencv_bioinspiredopencv_ccalibopencv_datasetsopencv_dnn_objdetectopencv_dnn_superresopencv_dpmopencv_faceopencv_freetypeopencv_fuzzyopencv_hfsopencv_img_hashopencv_intensity_transformopencv_line_descriptoropencv_mccopencv_optflowopencv_phase_unwrappingopencv_plotopencv_qualityopencv_rapidopencv_regopencv_rgbdopencv_saliencyopencv_sfmopencv_shapeopencv_stereoopencv_structured_lightopencv_superresopencv_surface_matchingopencv_textopencv_trackingopencv_videostabopencv_vizopencv_wechat_qrcodeopencv_xfeatures2dopencv_ximgprocopencv_xobjdetectopencv_xphotoopencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_highguiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_alphamatopencv_arucoopencv_bgsegmopencv_bioinspiredopencv_ccalibopencv_datasetsopencv_dnn_objdetectopencv_dnn_superresopencv_dpmopencv_faceopencv_freetypeopencv_fuzzyopencv_hfsopencv_img_hashopencv_intensity_transformopencv_line_descriptoropencv_mccopencv_optflowopencv_phase_unwrappingopencv_plotopencv_qualityopencv_rapidopencv_regopencv_rgbdopencv_saliencyopencv_sfmopencv_shapeopencv_stereoopencv_structured_lightopencv_superresopencv_surface_matchingopencv_textopencv_trackingopencv_videostabopencv_vizopencv_wechat_qrcodeopencv_xfeatures2dopencv_ximgprocopencv_xobjdetectopencv_xphoto
      -- Configuring done (1.5s)
      -- Generating done (0.0s)
      -- Build files have been written to: /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/build/temp.macosx-14-arm64-cpython-311
      [ 16%] Building CXX object CMakeFiles/tlsd.dir/src/lsd.cpp.o
      [ 33%] Linking CXX static library libtlsd.a
      [ 33%] Built target tlsd
      [ 50%] Building CXX object CMakeFiles/pytlsd.dir/src/PYAPI.cpp.o
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:45:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/attr.h:13:
      /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/cast.h:446:36: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                      "  " + handle(frame->f_code->co_filename).cast<std::string>() +
                                         ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:45:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/attr.h:13:
      /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/cast.h:448:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                      handle(frame->f_code->co_name).cast<std::string>() + "\n";
                                  ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:45:
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/attr.h:13:
      /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/cast.h:449:26: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                  frame = frame->f_back;
                               ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2291:49: error: no member named 'frame' in '_ts'
          PyFrameObject *frame = PyThreadState_Get()->frame;
                                 ~~~~~~~~~~~~~~~~~~~  ^
      /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2292:41: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
          if (frame && (std::string) str(frame->f_code->co_name) == name &&
                                              ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2293:14: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
              frame->f_code->co_argcount > 0) {
                   ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2296:18: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                  frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                       ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      In file included from /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/src/PYAPI.cpp:1:
      /Users/ouz/Desktop/deepLSD/DeepLSD/third_party/pytlsd/pybind11/include/pybind11/pybind11.h:2296:52: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                  frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                                                         ^
      /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
      typedef struct _frame PyFrameObject;
                     ^
      8 errors generated.
      make[2]: *** [CMakeFiles/pytlsd.dir/src/PYAPI.cpp.o] Error 1
      make[1]: *** [CMakeFiles/pytlsd.dir/all] Error 2
      make: *** [all] Error 2
      Traceback (most recent call last):
        File "/Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 434, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 419, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 65, in <module>
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/private/var/folders/rp/d8kwybr118xd68k4qcxw93vw0000gn/T/pip-build-env-pnt_crwk/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 58, in build_extension
        File "/opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pytlsd
rpautrat commented 1 year ago

This is related to pybind and CMake, so can't help much with this issue... But one quick fix could be to downgrade your CMake version to <= 3.26.

ogencoglu commented 1 year ago

Thanks a lot for the swift reply! Truly appreciated!

cmake 3.26 did not work either but then I ran git submodule update --remote --recursive and added --no-cache-dir to the pip install commands in quickstart_install.sh and it indeed worked. Maybe it was using some cached version or something.

But now when I try to run the quickstart notebook, I get the following error:

     10 from deeplsd.utils.tensor import batch_to_device
---> 11 from deeplsd.models.deeplsd_inference import DeepLSD
     12 from deeplsd.geometry.viz_2d import plot_images, plot_lines

File ~/Desktop/deepLSD/DeepLSD/deeplsd/models/deeplsd_inference.py:14
     12 from ..geometry.line_utils import merge_lines, filter_outlier_lines
     13 from ..utils.tensor import preprocess_angle
---> 14 from pytlsd import lsd
     17 class DeepLSD(BaseModel):
     18     default_conf = {
     19         'line_neighborhood': 5,
     20         'multiscale': False,
   (...)
     28         },
     29     }

ImportError: dlopen(/Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/pytlsd.cpython-311-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/mbedtls/lib/libmbedcrypto.14.dylib
  Referenced from: <8C2E2CF9-054E-300F-BDE7-3DE52F848638> /opt/homebrew/Cellar/librist/0.2.7_3/lib/librist.4.dylib
  Reason: tried: '/opt/homebrew/opt/mbedtls/lib/libmbedcrypto.14.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/mbedtls/lib/libmbedcrypto.14.dylib' (no such file), '/opt/homebrew/opt/mbedtls/lib/libmbedcrypto.14.dylib' (no such file), '/usr/local/lib/libmbedcrypto.14.dylib' (no such file), '/usr/lib/libmbedcrypto.14.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/mbedtls/3.5.0/lib/libmbedcrypto.14.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/mbedtls/3.5.0/lib/libmbedcrypto.14.dylib' (no such file), '/opt/homebrew/Cellar/mbedtls/3.5.0/lib/libmbedcrypto.14.dylib' (no such file), '/usr/local/lib/libmbedcrypto.14.dylib' (no such file), '/usr/lib/libmbedcrypto.14.dylib' (no such file, not in dyld cache)

Interestingly, the first import (line 10) works. Also tested outside notebook in command line python. Importing plot_image, plot_lines and batch_to_device works.

Any tips? Meanwhile, I will continue debugging and update here if I find a fix.

ogencoglu commented 1 year ago

Solved it by reinstalling ffmpeg

brew uninstall librist --ignore-dependencies
brew uninstall mbedtls --ignore-dependencies
brew reinstall ffmpeg

Now import works but with this warning:

objc[15375]: Class CaptureDelegate is implemented in both /Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/cv2/cv2.abi3.so (0x1509725e0) and /opt/homebrew/Cellar/opencv/4.8.1_1/lib/libopencv_videoio.4.8.1.dylib (0x16b7f0880). One of the two will be used. Which one is undefined.
objc[15375]: Class CVWindow is implemented in both /Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/cv2/cv2.abi3.so (0x150972630) and /opt/homebrew/Cellar/opencv/4.8.1_1/lib/libopencv_highgui.4.8.1.dylib (0x169c08b38). One of the two will be used. Which one is undefined.
objc[15375]: Class CVView is implemented in both /Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/cv2/cv2.abi3.so (0x150972658) and /opt/homebrew/Cellar/opencv/4.8.1_1/lib/libopencv_highgui.4.8.1.dylib (0x169c08b60). One of the two will be used. Which one is undefined.
objc[15375]: Class CVSlider is implemented in both /Users/ouz/Desktop/deepLSD/DeepLSD/deeplsd_venv/lib/python3.11/site-packages/cv2/cv2.abi3.so (0x150972680) and /opt/homebrew/Cellar/opencv/4.8.1_1/lib/libopencv_highgui.4.8.1.dylib (0x169c08b88). One of the two will be used. Which one is undefined.

Nevertheless, the notebook runs. Thanks a lot!