cvg / GlueStick

Joint Deep Matcher for Points and Lines 🖼️💥🖼️ (ICCV 2023)
https://iago-suarez.com/gluestick
MIT License
532 stars 40 forks source link

Building wheel for pytlsd error #1

Closed YznMur closed 1 year ago

YznMur commented 1 year ago

Hi I am trying to build the environment, but faced this error:

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
ERROR: Could not build wheels for pytlsd, which is required to install pyproject.toml-based projects

Python 3.9 + requirements.txt are used. I'd be grateful if you could help me solving it

rpautrat commented 1 year ago

Hi, to better isolate the problem, maybe you could try installing pytlsd in a separate repo. You will need to follow the instructions on the original pytlsd repo:

sudo apt-get install build-essential cmake libopencv-dev libopencv-contrib-dev libarpack++2-dev libarpack2-dev libsuperlu-dev
git clone --recursive https://github.com/iago-suarez/pytlsd.git
cd pytlsd
pip3 install -r requirements.txt
pip3 install .

Hopefully, it can solve your problem.

YznMur commented 1 year ago

Thanks for ur response It did not work. Showed the same error when I ran:

pip3 install .

Any other ideas?

rpautrat commented 1 year ago

Can you please paste the full error message?

YznMur commented 1 year ago

Running :

pip3 install .

I got :

Obtaining file:///home/yazan/GlueStick/pytlsd
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: pytlsd
  Building editable for pytlsd (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for pytlsd (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [287 lines of output]
      running editable_wheel
      creating /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info
      writing /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/dependency_links.txt
      writing top-level names to /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/top_level.txt
      writing manifest file '/tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/SOURCES.txt'
      reading manifest file '/tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/SOURCES.txt'
      creating '/tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd-0.0.3.dist-info'
      creating /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd-0.0.3.dist-info/WHEEL
      running build_ext
      -- The C compiler identification is GNU 9.4.0
      -- The CXX compiler identification is GNU 9.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /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: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- pybind11 v2.6.2
      -- Found PythonInterp: /home/yazan/anaconda3/envs/stick/bin/python (found version "3.11.2")
      -- Found PythonLibs: /home/yazan/anaconda3/envs/stick/lib/libpython3.11.so
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      --     OpenCV_DIR: /usr/local/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /usr/local/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoio
      --     OpenCV_DIR: /usr/local/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /usr/local/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoio
      -- Configuring done (0.3s)
      -- Generating done (0.0s)
      -- Build files have been written to: /tmp/tmpkhrxrgns.build-temp
      [ 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 /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h: In function ‘std::string pybind11::detail::error_string()’:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:446:36: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                    ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:446:75: error: expected primary-expression before ‘>’ token
        446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                                                           ^
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:446:77: error: expected primary-expression before ‘)’ token
        446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                                                             ^
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:448:29: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                             ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:448:64: error: expected primary-expression before ‘>’ token
        448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                                                                ^
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:448:66: error: expected primary-expression before ‘)’ token
        448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                                                                  ^
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:449:26: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        449 |             frame = frame->f_back;
            |                          ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h: In function ‘pybind11::function pybind11::detail::get_type_override(const void*, const pybind11::detail::type_info*, const char*)’:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2291:49: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘frame’; did you mean ‘cframe’?
       2291 |     PyFrameObject *frame = PyThreadState_Get()->frame;
            |                                                 ^~~~~
            |                                                 cframe
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2292:41: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       2292 |     if (frame && (std::string) str(frame->f_code->co_name) == name &&
            |                                         ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2293:14: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       2293 |         frame->f_code->co_argcount > 0) {
            |              ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2296:18: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       2296 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
            |                  ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:38,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2296:30: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       2296 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
            |                              ^~~~~~~~~~~~~~~~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      make[2]: *** [CMakeFiles/pytlsd.dir/build.make:76: CMakeFiles/pytlsd.dir/src/PYAPI.cpp.o] Error 1
      make[1]: *** [CMakeFiles/Makefile2:130: CMakeFiles/pytlsd.dir/all] Error 2
      make: *** [Makefile:101: all] Error 2
      Traceback (most recent call last):
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 147, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 328, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 259, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 286, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-wn7xccbo/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 "/home/yazan/anaconda3/envs/stick/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.
      /tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py:151: _DebuggingTips: An error happened while installing 'pytlsd' in editable mode.

              ************************************************************************
              The following steps are recommended to help debugging this problem:

              - Try to install the project normally, without using the editable mode.
                Does the error still persists?
                (If it does, try fixing the problem before attempting the editable mode).
              - If you are using binary extensions, make sure you have all OS-level
                dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
              - Try the latest version of setuptools (maybe the error was already fixed).
              - If you (or your project dependencies) are using any setuptools extension
                or customization, make sure they support the editable mode.

              After following the steps above, if the problem still persist and
              you think this is related to how setuptools handles editable installations,
              please submit a reproducible example
              (see https://stackoverflow.com/help/minimal-reproducible-example) to:

                  https://github.com/pypa/setuptools/issues

              More information about editable installs can be found in the docs:

                  https://setuptools.pypa.io/en/latest/userguide/development_mode.html
              ************************************************************************

        _DebuggingTips.warn(project)
      Traceback (most recent call last):
        File "/home/yazan/anaconda3/envs/stick/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/yazan/anaconda3/envs/stick/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 "/home/yazan/anaconda3/envs/stick/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 273, in build_editable
          return hook(wheel_directory, config_settings, metadata_directory)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 442, in build_editable
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 65, in <module>
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 147, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 328, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 259, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 286, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-wn7xccbo/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 "/home/yazan/anaconda3/envs/stick/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 editable for pytlsd
Failed to build pytlsd
ERROR: Could not build wheels for pytlsd, which is required to install pyproject.toml-based projects
YznMur commented 1 year ago

Could you, plz, provide more information about your environment? like : ubuntu/python versions

rpautrat commented 1 year ago

From your output, it seems you are using python 3.11. Can you try with an earlier version? I tested it personally under Python 3.7 and 3.8, with Ubuntu 18.04 (but later Ubuntu should be no problem).

YznMur commented 1 year ago

@rpautrat Hi I have tried python 3.7 and 3.8. Looks like python version is not the problem

rpautrat commented 1 year ago

Any idea, @iago-suarez?

iago-suarez commented 1 year ago

Hi guys,

I'm trying to figure out what is happening. I am adding continuous integration to the PyTLSD repo to find the problem and also to prevent future problems.

In the meantime, @YznMur have you executed?

sudo apt-get install build-essential cmake libopencv-dev libopencv-contrib-dev libarpack++2-dev libarpack2-dev libsuperlu-dev

I would also execute

sudo apt-get install libpython3.11-dev python3-numpy

And then try to re-compile PyTLSD.

I would be also quite informative if you could run:

sudo apt-get install build-essential cmake libopencv-dev libopencv-contrib-dev libarpack++2-dev libarpack2-dev libsuperlu-dev 
git clone --recursive https://github.com/iago-suarez/pytlsd.git
cd pytlsd/
mkdir build && cd build
cmake ..
make 

And paste here the output of the commands :)

iago-suarez commented 1 year ago

Okay, I was actually able to reproduce the problem for Python 3.11 using Continuous Integration.

The problem is that Pybind11 was not ready for Python3.11, just by uploading Pybind11 submodule the problem disappears! :smile:

YznMur commented 1 year ago

Hi guys,

I'm trying to figure out what is happening. I am adding continuous integration to the PyTLSD repo to find the problem and also to prevent future problems.

In the meantime, @YznMur have you executed?

sudo apt-get install build-essential cmake libopencv-dev libopencv-contrib-dev libarpack++2-dev libarpack2-dev libsuperlu-dev

I would also execute

sudo apt-get install libpython3.11-dev python3-numpy

And then try to re-compile PyTLSD.

I would be also quite informative if you could run:

sudo apt-get install build-essential cmake libopencv-dev libopencv-contrib-dev libarpack++2-dev libarpack2-dev libsuperlu-dev 
git clone --recursive https://github.com/iago-suarez/pytlsd.git
cd pytlsd/
mkdir build && cd build
cmake ..
make 

And paste here the output of the commands :)

Hi @iago-suarez Thanks for ur help The output of make is :

[ 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
[ 66%] Linking CXX shared module pytlsd.cpython-311-x86_64-linux-gnu.so
[ 66%] Built target pytlsd
[ 83%] Building CXX object CMakeFiles/test_tlsd.dir/tests/test_tlsd.cpp.o
/home/yazan/GlueStick/pytlsd/tests/test_tlsd.cpp: In function ‘int main(int, char**)’:
/home/yazan/GlueStick/pytlsd/tests/test_tlsd.cpp:32:9: error: ‘imshow’ is not a member of ‘cv’
   32 |     cv::imshow("segments", color);
      |         ^~~~~~
/home/yazan/GlueStick/pytlsd/tests/test_tlsd.cpp:33:9: error: ‘waitKey’ is not a member of ‘cv’; did you mean ‘write’?
   33 |     cv::waitKey();
      |         ^~~~~~~
      |         write
make[2]: *** [CMakeFiles/test_tlsd.dir/build.make:76: CMakeFiles/test_tlsd.dir/tests/test_tlsd.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:156: CMakeFiles/test_tlsd.dir/all] Error 2
make: *** [Makefile:101: all] Error 2
YznMur commented 1 year ago

Okay, I was actually able to reproduce the problem for Python 3.11 using Continuous Integration.

The problem is that Pybind11 was not ready for Python3.11, just by uploading Pybind11 submodule the problem disappears! 😄

I updated Pybind11 but it also didn't work :(

iago-suarez commented 1 year ago

Hi, then it actually works! The only error you are obtaining is because you don't have OpenCV well installed, but it is only a requirement to execute the C++ tests. You have successfully compiled the library: pytlsd.cpython-311-x86_64-linux-gnu.so.

If it keeps giving problems to you it is probably because you have some dirty directory around. I would suggest you to create a new environment and try:

python -m venv venv
source venv/bin/activate
git clone --recursive https://github.com/iago-suarez/pytlsd.git
pip install -r pytlsd/requirements.txt
pip install ./pytlsd

It should work. By the way, what is your OS?

YznMur commented 1 year ago

I am using Ubuntu 20.04 I have created a new environment, but running pip install ./pytlsd is still giving the same error before:

      subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for pytlsd
Failed to build pytlsd
ERROR: Could not build wheels for pytlsd, which is required to install pyproject.toml-based projects

I will give it another try later and come with feedback Thanks for ur time

iago-suarez commented 1 year ago

Ok, that's a generic error saying that something was wrong. Could you paste again the full error as you did in:

Running :

pip3 install .

I got :

Obtaining file:///home/yazan/GlueStick/pytlsd
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: pytlsd
  Building editable for pytlsd (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for pytlsd (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [287 lines of output]
      running editable_wheel
      creating /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info
      writing /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/dependency_links.txt
      writing top-level names to /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/top_level.txt
      writing manifest file '/tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/SOURCES.txt'
      reading manifest file '/tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd.egg-info/SOURCES.txt'
      creating '/tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd-0.0.3.dist-info'
      creating /tmp/pip-wheel-s5f3cv9x/.tmp-pb80xcf9/pytlsd-0.0.3.dist-info/WHEEL
      running build_ext
      -- The C compiler identification is GNU 9.4.0
      -- The CXX compiler identification is GNU 9.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /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: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- pybind11 v2.6.2
      -- Found PythonInterp: /home/yazan/anaconda3/envs/stick/bin/python (found version "3.11.2")
      -- Found PythonLibs: /home/yazan/anaconda3/envs/stick/lib/libpython3.11.so
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      --     OpenCV_DIR: /usr/local/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /usr/local/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoio
      --     OpenCV_DIR: /usr/local/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /usr/local/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoio
      -- Configuring done (0.3s)
      -- Generating done (0.0s)
      -- Build files have been written to: /tmp/tmpkhrxrgns.build-temp
      [ 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 /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h: In function ‘std::string pybind11::detail::error_string()’:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:446:36: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                    ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:446:75: error: expected primary-expression before ‘>’ token
        446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                                                           ^
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:446:77: error: expected primary-expression before ‘)’ token
        446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                                                             ^
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:448:29: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                             ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:448:64: error: expected primary-expression before ‘>’ token
        448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                                                                ^
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:448:66: error: expected primary-expression before ‘)’ token
        448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                                                                  ^
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:449:26: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        449 |             frame = frame->f_back;
            |                          ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h: In function ‘pybind11::function pybind11::detail::get_type_override(const void*, const pybind11::detail::type_info*, const char*)’:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2291:49: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘frame’; did you mean ‘cframe’?
       2291 |     PyFrameObject *frame = PyThreadState_Get()->frame;
            |                                                 ^~~~~
            |                                                 cframe
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2292:41: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       2292 |     if (frame && (std::string) str(frame->f_code->co_name) == name &&
            |                                         ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2293:14: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       2293 |         frame->f_code->co_argcount > 0) {
            |              ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2296:18: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       2296 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
            |                  ^~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:38,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:2296:30: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       2296 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
            |                              ^~~~~~~~~~~~~~~~
      In file included from /home/yazan/anaconda3/envs/stick/include/python3.11/Python.h:42,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/detail/common.h:124,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pytypes.h:12,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/cast.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/attr.h:13,
                       from /home/yazan/GlueStick/pytlsd/pybind11/include/pybind11/pybind11.h:45,
                       from /home/yazan/GlueStick/pytlsd/src/PYAPI.cpp:1:
      /home/yazan/anaconda3/envs/stick/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      make[2]: *** [CMakeFiles/pytlsd.dir/build.make:76: CMakeFiles/pytlsd.dir/src/PYAPI.cpp.o] Error 1
      make[1]: *** [CMakeFiles/Makefile2:130: CMakeFiles/pytlsd.dir/all] Error 2
      make: *** [Makefile:101: all] Error 2
      Traceback (most recent call last):
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 147, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 328, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 259, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 286, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-wn7xccbo/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 "/home/yazan/anaconda3/envs/stick/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.
      /tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py:151: _DebuggingTips: An error happened while installing 'pytlsd' in editable mode.

              ************************************************************************
              The following steps are recommended to help debugging this problem:

              - Try to install the project normally, without using the editable mode.
                Does the error still persists?
                (If it does, try fixing the problem before attempting the editable mode).
              - If you are using binary extensions, make sure you have all OS-level
                dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
              - Try the latest version of setuptools (maybe the error was already fixed).
              - If you (or your project dependencies) are using any setuptools extension
                or customization, make sure they support the editable mode.

              After following the steps above, if the problem still persist and
              you think this is related to how setuptools handles editable installations,
              please submit a reproducible example
              (see https://stackoverflow.com/help/minimal-reproducible-example) to:

                  https://github.com/pypa/setuptools/issues

              More information about editable installs can be found in the docs:

                  https://setuptools.pypa.io/en/latest/userguide/development_mode.html
              ************************************************************************

        _DebuggingTips.warn(project)
      Traceback (most recent call last):
        File "/home/yazan/anaconda3/envs/stick/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/yazan/anaconda3/envs/stick/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 "/home/yazan/anaconda3/envs/stick/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 273, in build_editable
          return hook(wheel_directory, config_settings, metadata_directory)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 442, in build_editable
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 65, in <module>
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 147, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 328, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 259, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/editable_wheel.py", line 286, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-wn7xccbo/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-wn7xccbo/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 "/home/yazan/anaconda3/envs/stick/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 editable for pytlsd
Failed to build pytlsd
ERROR: Could not build wheels for pytlsd, which is required to install pyproject.toml-based projects
YznMur commented 1 year ago

The output of pip install ./pytlsd is :

(venv) yazan@yazan-System-Product-Name:~/GlueStick$ pip install ./pytlsd
Processing ./pytlsd
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
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
  ╰─> [98 lines of output]
      running bdist_wheel
      running build
      running build_ext
      -- The C compiler identification is GNU 9.4.0
      -- The CXX compiler identification is GNU 9.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /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: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- pybind11 v2.10.4
      -- Found PythonInterp: /home/yazan/GlueStick/venv/bin/python (found suitable version "3.9.13", minimum required is "3.6")
      -- Found PythonLibs: /home/yazan/anaconda3/lib/libpython3.9.so
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      --     OpenCV_DIR: /usr/local/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /usr/local/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoio
      --     OpenCV_DIR: /usr/local/lib/cmake/opencv4
      --     OpenCV_INCLUDE_DIRS: /usr/local/include/opencv4
      --     OpenCV_LIBS: opencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoioopencv_calib3dopencv_coreopencv_dnnopencv_features2dopencv_flannopencv_gapiopencv_imgcodecsopencv_imgprocopencv_mlopencv_objdetectopencv_photoopencv_stitchingopencv_videoopencv_videoio
      -- Configuring done (0.3s)
      -- Generating done (0.0s)
      -- Build files have been written to: /home/yazan/GlueStick/pytlsd/build/temp.linux-x86_64-cpython-39/pytlsd
      [1/6] Building CXX object CMakeFiles/tlsd.dir/src/lsd.cpp.o
      [2/6] Linking CXX static library libtlsd.a
      [3/6] Building CXX object CMakeFiles/test_tlsd.dir/tests/test_tlsd.cpp.o
      FAILED: CMakeFiles/test_tlsd.dir/tests/test_tlsd.cpp.o
      /usr/bin/c++  -I/home/yazan/GlueStick/pytlsd/src -isystem /usr/local/include/opencv4 -w -std=c++17 -O3 -DNDEBUG -std=gnu++17 -fPIE -MD -MT CMakeFiles/test_tlsd.dir/tests/test_tlsd.cpp.o -MF CMakeFiles/test_tlsd.dir/tests/test_tlsd.cpp.o.d -o CMakeFiles/test_tlsd.dir/tests/test_tlsd.cpp.o -c /home/yazan/GlueStick/pytlsd/tests/test_tlsd.cpp
      /home/yazan/GlueStick/pytlsd/tests/test_tlsd.cpp: In function ‘int main(int, char**)’:
      /home/yazan/GlueStick/pytlsd/tests/test_tlsd.cpp:32:9: error: ‘imshow’ is not a member of ‘cv’
         32 |     cv::imshow("segments", color);
            |         ^~~~~~
      /home/yazan/GlueStick/pytlsd/tests/test_tlsd.cpp:33:9: error: ‘waitKey’ is not a member of ‘cv’; did you mean ‘write’?
         33 |     cv::waitKey();
            |         ^~~~~~~
            |         write
      [4/6] Building CXX object CMakeFiles/pytlsd.dir/src/PYAPI.cpp.o
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/home/yazan/GlueStick/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/yazan/GlueStick/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/yazan/GlueStick/venv/lib/python3.9/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 "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 413, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 138, in <module>
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-nk4_3jv2/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 132, in build_extension
        File "/home/yazan/anaconda3/lib/python3.9/subprocess.py", line 528, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 1.
      [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
ERROR: Could not build wheels for pytlsd, which is required to install pyproject.toml-based projects
iago-suarez commented 1 year ago

Ohh then it is not the same problem. You are very close. The problem you are experiencing now is that, for some reason, you have a bad installation of opencv. Try to remove it from your system with something like:

sudo apt-get remove --purge libopencv-*
sudo apt-get autoremove

Next, check that there is no directory /usr/local/lib/cmake/opencv4 nor /usr/local/include/opencv4

And then, repeat the sequence:

python -m venv venv
source venv/bin/activate
git clone --recursive https://github.com/iago-suarez/pytlsd.git
pip install -r pytlsd/requirements.txt
pip install ./pytlsd
YznMur commented 1 year ago

It worked! The problem was that I did not have OpenCV well installed. Removing OpenCV and /usr/local/lib/cmake/opencv4 and /usr/local/include/opencv4 directories, then reinstalling OpenCV from pytlsd/requirements.txt solved the problem. I will close the issue. Thanks a lot @iago-suarez @rpautrat