Issue installing pip libraries that require cmake

I have this huge error code. But i think it’s probably due to a recompile error on some libraries.

I’ve tried to:

  • Download Cmake and pip install cmake
  • Downloaded visual studio
  • Checked the PATH
  • Update pip
  • Roll back one version of python
  • Manually compiling the library
Collecting apriltag
  Using cached apriltag-0.0.16.tar.gz (201 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: apriltag
  Building wheel for apriltag (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [103 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      copying python\apriltag.py -> build\lib.win-amd64-cpython-311
      running build_ext
      C:\Users\Felipe\AppData\Local\Temp\pip-install-vfgs1wjy\apriltag_84cb2a8a6c8040eda73455095bdffe79\setup.py:30: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
      -- Building for: Visual Studio 17 2022
      CMake Warning (dev) at CMakeLists.txt:1 (project):
        cmake_minimum_required() should be called prior to this top-level project()
        call.  Please see the cmake-commands(7) manual for usage documentation of
        both commands.
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- The C compiler identification is MSVC 19.38.33134.0
      -- The CXX compiler identification is MSVC 19.38.33134.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - 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: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      CMake Deprecation Warning at CMakeLists.txt:3 (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.


      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
      -- Looking for pthread_create in pthreads
      -- Looking for pthread_create in pthreads - not found
      -- Looking for pthread_create in pthread
      -- Looking for pthread_create in pthread - not found
      -- Found Threads: TRUE
      -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
      -- Checking for one of the modules 'opencv>=2.3;opencv-2.3.1;opencv-3.0.0'
      -- Configuring done (16.3s)
      -- Generating done (0.1s)
      CMake Warning:
        Manually-specified variables were not used by the project:

          PYTHON_EXECUTABLE


      -- Build files have been written to: C:/Users/Felipe/AppData/Local/Temp/pip-install-vfgs1wjy/apriltag_84cb2a8a6c8040eda73455095bdffe79/build/temp.win-amd64-cpython-311/Release
      VersÆo do MSBuild 17.8.5+b5265ef37 para .NET Framework

      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: O diret¢rio Intermedi rio ou o diret¢rio de Sa¡da nÆo podem residir sob o diret¢rio Tempor rio porque isso poderia levar a problemas com a compila‡Æo incremental. [C:\Users\Felipe\AppData\Local\Temp\pip-install-vfgs1wjy\apriltag_84cb2a8a6c8040eda73455095bdffe79\build\temp.win-amd64-cpython-311\Release\ZERO_CHECK.vcxproj]
        1>Checking Build System
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: O diret¢rio Intermedi rio ou o diret¢rio de Sa¡da nÆo podem residir sob o diret¢rio Tempor rio porque isso poderia levar a problemas com a compila‡Æo incremental. [C:\Users\Felipe\AppData\Local\Temp\pip-install-vfgs1wjy\apriltag_84cb2a8a6c8040eda73455095bdffe79\build\temp.win-amd64-cpython-311\Release\core\apriltag.vcxproj]
        Building Custom Rule C:/Users/Felipe/AppData/Local/Temp/pip-install-vfgs1wjy/apriltag_84cb2a8a6c8040eda73455095bdffe79/core/CMakeLists.txt
      cl : linha de comando  error D8021: argumento num‚rico inv lido '/Wsign-compare' [C:\Users\Felipe\AppData\Local\Temp\pip-install-vfgs1wjy\apriltag_84cb2a8a6c8040eda73455095bdffe79\build\temp.win-amd64-cpython-311\Release\core\apriltag.vcxproj]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Felipe\AppData\Local\Temp\pip-install-vfgs1wjy\apriltag_84cb2a8a6c8040eda73455095bdffe79\setup.py", line 62, in <module>
          setup(
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 963, in run_command
          super().run_command(command)
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 963, in run_command
          super().run_command(command)
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
          self.run_command(cmd_name)
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\dist.py", line 963, in run_command
          super().run_command(command)
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\Felipe\AppData\Local\Temp\pip-install-vfgs1wjy\apriltag_84cb2a8a6c8040eda73455095bdffe79\setup.py", line 35, in run
          self.build_extension(ext)
        File "C:\Users\Felipe\AppData\Local\Temp\pip-install-vfgs1wjy\apriltag_84cb2a8a6c8040eda73455095bdffe79\setup.py", line 60, in build_extension
          subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
        File "C:\Users\Felipe\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' 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 apriltag
  Running setup.py clean for apriltag
Failed to build apriltag
ERROR: Could not build wheels for apriltag, which is required to install pyproject.toml-based projects```

Where did you get stuck trying to manually compile the library? That seems like the best path forward, but tbh because I don’t understand the language I am not quite sure what issue the C compiler has.

This looks like the important part. It seems that some adequate support for threading was found, as a fallback after several preferred options. But then it couldn’t find a PkgConfig implementation, which is needed for building.

There’s also a warning that suggests updating your version of CMake.

This is also in general an important part of such error traces. You should try the command by itself (in this case, cmake --build . --config Release -- /m) to get a more focused error log.

Apparently this is a bug in the C code: Command line error D8021: invalid numeric argument

Suggest you ask the authors/maintainers of the code for a solution.