threestudio-project / threestudio

A unified framework for 3D content generation.
Apache License 2.0
6.32k stars 480 forks source link

Could not locate a supported Microsoft Visual C++ installation #378

Open Apotrox opened 11 months ago

Apotrox commented 11 months ago

Figured i'll put this up here for anyone interested and/or running into that same issue:

reparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\xxx\AppData\Local\Temp\pip-req-build-d21ewxtp\bindings/torch\setup.py", line 72, in <module>
          raise RuntimeError("Could not locate a supported Microsoft Visual C++ installation")
      RuntimeError: Could not locate a supported Microsoft Visual C++ installation
      Building PyTorch extension for tiny-cuda-nn version 1.7
      Obtained compute capability 86 from PyTorch
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

Just installing Visual C++ Runtime isn't enough. You need the VS build tools. Download the Visual Studio installer from Microsoft, go to the Components tab and look for "buildtools". Keep in mind you probably want to pick one that still is supported by microsoft and by your cpu architecture ( x86/ ARM). It took me two days to figure this out. You're welcome. Have a great day.

A few sidenotes: Also, while you're already at it, install the SDK for your OS. So Windows 11 SDK or Windows 10 SDK, from the Visual Studio installer. And make sure you have installed a cuda version that's used in pytorch. So 11.8 or 11.3. uninstall the newer version first. Successfully installed the build tools, sdk and reinstalled the right version of cuda? Great, now downgrade pip to 23.0.1 and reboot your pc.