cvg / pixel-perfect-sfm

Pixel-Perfect Structure-from-Motion with Featuremetric Refinement (ICCV 2021, Best Student Paper Award)
Apache License 2.0
1.29k stars 132 forks source link

Any known issues on WSL? / Trouble building ceres solver #142

Open tworkool opened 1 week ago

tworkool commented 1 week ago

Hello, I am trying to build and install the dependencies with cmake and gcc on WSL, but it fails to compile these dependencies. Ive tried everything that comes to my mind (updating, reinstalling packages etc.). Has anybody tried building it on WSL and also had trouble? I cannot build the ceres solver.

Phil26AT commented 1 week ago

Hey! It used to work on WSL some time ago, but haven't tried it recently. Do you know what breaks or have some logs?

tworkool commented 1 week ago

Thanks for the quick response. I actually just managed to buiuld and install ceres on WSL by allocation more host memory. However when trying to install the python dependencies pyceres and pycolmap from source they both fail. Here is some log content after running pip install for the requirements:

     In file included from /root/miniconda3/envs/pixsfm/include/python3.12/Python.h:42,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/detail/common.h:186,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pytypes.h:12,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/cast.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/attr.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pybind11.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/iostream.h:22,
                       from /tmp/pip-req-build-r6heusdq/_pyceres/bindings.cc:1:
      /root/miniconda3/envs/pixsfm/include/python3.12/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /root/miniconda3/envs/pixsfm/include/python3.12/Python.h:38,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/detail/common.h:186,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pytypes.h:12,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/cast.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/attr.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pybind11.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/iostream.h:22,
                       from /tmp/pip-req-build-r6heusdq/_pyceres/bindings.cc:1:
      /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pybind11.h: In function ‘pybind11::function pybind11::detail::get_type_override(const void*, const pybind11::detail::type_info*, const char*)’:
      /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pybind11.h:2348:29: error: ‘PyCodeObject’ {aka ‘struct PyCodeObject’} has no member named ‘co_varnames’; did you mean ‘co_names’?
       2348 |                     locals, PyTuple_GET_ITEM(f_code->co_varnames, 0)
            |                             ^~~~~~~~~~~~~~~~
      make[2]: *** [CMakeFiles/pyceres.dir/build.make:76: CMakeFiles/pyceres.dir/_pyceres/bindings.cc.o] Error 1
      make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/pyceres.dir/all] Error 2
      make: *** [Makefile:91: all] Error 2
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-r6heusdq/setup.py", line 80, in <module>
          setup(
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-req-build-r6heusdq/setup.py", line 34, in run
          self.build_extension(ext)
        File "/tmp/pip-req-build-r6heusdq/setup.py", line 77, in build_extension
          subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' 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 pyceres
  Running setup.py clean for pyceres
Failed to build pycolmap pyceres
ERROR: Could not build wheels for pycolmap, pyceres, which is required to install pyproject.toml-based projects
tworkool commented 1 week ago

I am not too familiar with building py packages from source and also have not a lot of experience with cmake tbh... So any tip is helpful atp

Phil26AT commented 3 days ago

Hi @tworkool, sorry for the late reply. I think this is related to the pybind version being outdated, and not compatible with your python version (are you running on 3.11?). I'd suggest to just update pybind in pixsfm to the first release version that supports python 3.11. You might have to apply these changes upstream too, e.g. in pyceres. If this solves your issue please open a PR! :)

tworkool commented 3 days ago

I managed to get everything installed in a new conda environment with python 3.8.2 As you mentioned, I updated the requirements for pybind, pycolmap and pyceres. I bumped the versions to the following:

Before I was using python 3.12, havent tried to setup in that environment but am gonna stick with 3.8.2 When I am done with testing I will open a PR. Thanks for the tip!