Failed building wheel for pycolmap (WSL, Ubuntu 22.04)

343 views Asked by At

I installed "pycolmap", however there was some errors.

[Condition] I'm using wsl2 and ubuntu 22.04. I downloaded pycolmap from this link: https://github.com/colmap/pycolmap I downloaded colmap from this link: https://colmap.github.io/install.html

[Code]

home/user_name/venv_name/pixel-perfect-sfm/colmap $ pip install pycolmap
home/user_name/venv_name/pixel-perfect-sfm/colmap $ git clone https://github.com/colmap/pycolmap.git
home/user_name/venv_name/pixel-perfect-sfm/colmap $ cd pycolmap
home/user_name/venv_name/pixel-perfect-sfm/colmap/pycolmap $ pip install .

[Error messages] When I build the pycolmap using GNinja, there were some error messages like below.

Compiling bindings without CUDA support.
Compiling bindings with CGAL support.
CMake Error at CMakeLists.txt:41 (find_package):
  By not providing "FindPTHREAD.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "PTHREAD", but
  CMake did not find one.

  Could not find a package configuration file provided by "PTHREAD" with any
  of the following names:

    PTHREADConfig.cmake
    pthread-config.cmake

  Add the installation prefix of "PTHREAD" to CMAKE_PREFIX_PATH or set
  "PTHREAD_DIR" to a directory containing one of the above files.  If
  "PTHREAD" provides a separate development package or SDK, be sure it has
  been installed.


-- Configuring incomplete, errors occurred!

When I build the pycolmap using "pip install .", there were some error messages like below.

Processing /home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycolmap
  Building wheel for pycolmap (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [98 lines of output]
      running bdist_wheel
      running build
      running build_ext
      ['cmake', '/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/build/lib.linux-x86_64-3.10', '-DPYTHON_EXECUTABLE=/home/ywk0524/venv_python/bin/python3', '-DVERSION_INFO=0.5.0', '-DCMAKE_BUILD_TYPE=Release']
      -- Found required Ceres dependency: Eigen version 3.4.0 in /usr/include/eigen3
      -- Found required Ceres dependency: glog
      -- Found required Ceres dependency: gflags
      -- Found Ceres version: 2.0.0 installed in: /usr with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, Multithreading]
      -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: program_options filesystem system unit_test_framework
      -- Found Eigen
      --   Includes : /usr/include/eigen3
      -- Found FLANN
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libflann.so
      -- Found LZ4
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/liblz4.so
      -- Found FreeImage
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
      -- Found Glog
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
      -- Found SQLite3
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libsqlite3.so
      -- Found Glew
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
      CMake Warning at /usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALConfig.cmake:92 (message):
        CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the
        default value of CGAL::data_file_path()
      Call Stack (most recent call first):
        /usr/local/share/colmap/COLMAPConfig.cmake:224 (find_package)
        CMakeLists.txt:4 (find_package)


      -- Using header-only CGAL
      -- Targetting Unix Makefiles
      -- Using /usr/bin/c++ compiler.
      -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.48")
      -- Boost include dirs: /usr/include
      -- Boost libraries:
      -- Using gcc version 4 or later. Adding -frounding-math
      -- pybind11 v2.8.1
      Compiling bindings without CUDA support.
      Compiling bindings with CGAL support.
      CMake Error at CMakeLists.txt:41 (find_package):
        By not providing "FindPTHREAD.cmake" in CMAKE_MODULE_PATH this project has
        asked CMake to find a package configuration file provided by "PTHREAD", but
        CMake did not find one.

        Could not find a package configuration file provided by "PTHREAD" with any
        of the following names:

          PTHREADConfig.cmake
          pthread-config.cmake

        Add the installation prefix of "PTHREAD" to CMAKE_PREFIX_PATH or set
        "PTHREAD_DIR" to a directory containing one of the above files.  If
        "PTHREAD" provides a separate development package or SDK, be sure it has
        been installed.


      -- Configuring incomplete, errors occurred!
      See also "/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/build/temp.linux-x86_64-3.10/CMakeFiles/CMakeOutput.log".
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/setup.py", line 83, in <module>
          setup(
        File "/home/ywk0524/venv_python/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/ywk0524/venv_python/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/setup.py", line 35, in run
          self.build_extension(ext)
        File "/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/setup.py", line 77, in build_extension
          subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
        File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/build/lib.linux-x86_64-3.10', '-DPYTHON_EXECUTABLE=/home/ywk0524/venv_python/bin/python3', '-DVERSION_INFO=0.5.0', '-DCMAKE_BUILD_TYPE=Release']' 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 pycolmap
  Running setup.py clean for pycolmap
Failed to build pycolmap
Installing collected packages: pycolmap
  Attempting uninstall: pycolmap
    Found existing installation: pycolmap 0.4.0
    Uninstalling pycolmap-0.4.0:
      Successfully uninstalled pycolmap-0.4.0
  Running setup.py install for pycolmap ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pycolmap did not run successfully.
  │ exit code: 1
  ╰─> [127 lines of output]
      running install
      /home/ywk0524/venv_python/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      ['cmake', '/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/build/lib.linux-x86_64-3.10', '-DPYTHON_EXECUTABLE=/home/ywk0524/venv_python/bin/python3', '-DVERSION_INFO=0.5.0', '-DCMAKE_BUILD_TYPE=Release']
      -- The C compiler identification is GNU 11.3.0
      -- The CXX compiler identification is GNU 11.3.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
      -- Looking for pthread.h
      -- Looking for pthread.h - found
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE
      -- Found required Ceres dependency: Eigen version 3.4.0 in /usr/include/eigen3
      -- Found required Ceres dependency: glog
      -- Found required Ceres dependency: gflags
      -- Found Ceres version: 2.0.0 installed in: /usr with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, Multithreading]
      -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: program_options filesystem system unit_test_framework
      -- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0")
      -- Found Eigen
      --   Includes : /usr/include/eigen3
      -- Found FLANN
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libflann.so
      -- Found LZ4
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/liblz4.so
      -- Found FreeImage
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
      -- Found Glog
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
      -- Found SQLite3
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libsqlite3.so
      -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
      -- Found Glew
      --   Includes : /usr/include
      --   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
      CMake Warning at /usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALConfig.cmake:92 (message):
        CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the
        default value of CGAL::data_file_path()
      Call Stack (most recent call first):
        /usr/local/share/colmap/COLMAPConfig.cmake:224 (find_package)
        CMakeLists.txt:4 (find_package)


      -- Using header-only CGAL
      -- Targetting Unix Makefiles
      -- Using /usr/bin/c++ compiler.
      -- Found GMP: /usr/lib/x86_64-linux-gnu/libgmp.so
      -- Found MPFR: /usr/lib/x86_64-linux-gnu/libmpfr.so
      -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.48")
      -- Boost include dirs: /usr/include
      -- Boost libraries:
      -- Using gcc version 4 or later. Adding -frounding-math
      -- pybind11 v2.8.1
      -- Found PythonInterp: /home/ywk0524/venv_python/bin/python3 (found version "3.10.6")
      -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.10.so
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      Compiling bindings without CUDA support.
      Compiling bindings with CGAL support.
      CMake Error at CMakeLists.txt:41 (find_package):
        By not providing "FindPTHREAD.cmake" in CMAKE_MODULE_PATH this project has
        asked CMake to find a package configuration file provided by "PTHREAD", but
        CMake did not find one.

        Could not find a package configuration file provided by "PTHREAD" with any
        of the following names:

          PTHREADConfig.cmake
          pthread-config.cmake

        Add the installation prefix of "PTHREAD" to CMAKE_PREFIX_PATH or set
        "PTHREAD_DIR" to a directory containing one of the above files.  If
        "PTHREAD" provides a separate development package or SDK, be sure it has
        been installed.


      -- Configuring incomplete, errors occurred!
      See also "/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/build/temp.linux-x86_64-3.10/CMakeFiles/CMakeOutput.log".
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/setup.py", line 83, in <module>
          setup(
        File "/home/ywk0524/venv_python/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/ywk0524/venv_python/lib/python3.10/site-packages/setuptools/command/install.py", line 68, in run
          return orig.install.run(self)
        File "/usr/lib/python3.10/distutils/command/install.py", line 619, in run
          self.run_command('build')
        File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/setup.py", line 35, in run
          self.build_extension(ext)
        File "/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/setup.py", line 77, in build_extension
          subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
        File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/ywk0524/venv_python/pixel-perfect-sfm/colmap/pycolmap/build/lib.linux-x86_64-3.10', '-DPYTHON_EXECUTABLE=/home/ywk0524/venv_python/bin/python3', '-DVERSION_INFO=0.5.0', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  WARNING: No metadata found in /home/ywk0524/venv_python/lib/python3.10/site-packages
  Rolling back uninstall of pycolmap
  Moving to /home/ywk0524/venv_python/lib/python3.10/site-packages/pycolmap-0.4.0.dist-info/
   from /home/ywk0524/venv_python/lib/python3.10/site-packages/~ycolmap-0.4.0.dist-info
  Moving to /home/ywk0524/venv_python/lib/python3.10/site-packages/pycolmap.cpython-310-x86_64-linux-gnu.so
   from /tmp/pip-uninstall-zlyj4784/pycolmap.cpython-310-x86_64-linux-gnu.so
  Moving to /home/ywk0524/venv_python/lib/python3.10/site-packages/pycolmap.libs/
   from /home/ywk0524/venv_python/lib/python3.10/site-packages/~ycolmap.libs
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pycolmap

How can I fix this bug?

[Trials]

Trial 1. update sudo apt-get update -> there were no changes in error.

Trial 2. Change the flags I tried to change the flags refer to a github issue. link: https://github.com/colmap/pycolmap/issues/65 If I try adding -fPIC to CUDA_NVCC_FLAGS in colmap's cmakelist.txt, I can disable CUDA. However I could not find flag part in colmap's cmakelist.txt. (Maybe txt is changed during colmap update)

0

There are 0 answers