Joonas' Note

Joonas' Note

[Windows 10] pytorch3d 설치 중 트러블 슈팅 본문

개발/python

[Windows 10] pytorch3d 설치 중 트러블 슈팅

2025. 3. 21. 07:19 joonas

    환경 세팅

    프록시 설정 때문에 pip install pytorch3d 는 불가한 상황이었고, 공식 설치 문서를 참고해서 직접 패키지를 설치해야했다.

    개인적으로 conda 를 잘 사용하지 않기도 하고, conda 세팅도 불가한 상황이라 virtualenv 로 실행 환경을 구축한 상황이다.

    python -m virtualenv .venv
    source .venv/Scripts/activate
    python -m pip install pytorch torchvision pytorch-cuda

    CL 명령어를 못 찾음

    ...
    copying pytorch3d\datasets\shapenet\shapenet_synset_dict_v2.json -> build\lib.win-amd64-cpython-311\pytorch3d\datasets\shapenet
    running build_ext
    D:\MLTest\.venv\Lib\site-packages\torch\utils\cpp_extension.py:380: UserWarning: Error checking compiler version for cl: [WinError 2] 지정된 파일을 찾을 수 없습니다
      warnings.warn(f'Error checking compiler version for {compiler}: {error}')
    error: [WinError 2] 지정된 파일을 찾을 수 없습니다

    해결

    Visual Studio Tools 에 있는 cl.exe 를 실행할 수 있도록 환경 변수 추가

    export PATH=$PATH:/d/Programs/Visual\ Studio/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64

    참고

     

    Installed Visual Studio 2022 but 'cl' is not recognized as an internal or external command

    None of my terminals on Windows 10 recognize cl 'as an internal or external command'. I have Visual Studio 2022 installed and I've tried it on every terminal, including terminals in the Visual Studio

    stackoverflow.com


    build_ext 이후 에러

    adding license file 'LICENSE-3RD-PARTY'
    writing manifest file 'pytorch3d.egg-info\SOURCES.txt'
    installing library code to build\bdist.win-amd64\egg
    running install_lib
    running build_py
    running build_ext
    error: [WinError 2] 지정된 파일을 찾을 수 없습니다

    해결

    CUDA_HOME 또는 CUDA_PATH 환경 변수 설정

    export CUDA_HOME=/d/Programs/NVIDIA\ Toolkits/CUDA/v12.4

    환경 변수 설정하고 다시 실행해보면 다음 단계인 building 'pytorch3d._C' extension 를 시작한다.

    참고

    https://stackoverflow.com/a/77463619

     

    running build_ext gives `[WinError 2] The system cannot find the file specified` while building detectron2

    I'm currently trying to build detectron2 in environment in Anaconda. Below is the packages that I'm using in my env: windows 11 conda package python 3.8 cuda 11.3 pytorch 1.11 torchaudio 0.11.0

    stackoverflow.com

     

    Comments