我要评分
获取效率
正确性
完整性
易理解

No Files Found When Running PyTorch Compilation and Installation Commands

Symptom

When running the python3 setup.py install command to compile and install PyTorch, a message is displayed indicating that CMakeLists.txt, Makefile, setup.py, LICENSE, LICENSE.md, and LICENSE.txt are not found in the /path/to/pytorch/third_party/ios-cmake directory.

Building wheel torch-2.1.0a0+gita8e7c98 Building version 
-- Building version 2.1.0a0+gita8e7c98 
Could not find any of CMakeLists.txt,Makefile,setup.py,LICENSE,LICENSE.md,LICENSE.txt in /path/to/pytorch/third_party/ios-cmake 
Did you run 'git submodule update --init --recursive'?

Key Process and Cause Analysis

The sub-repository dependency fails to be downloaded.

Conclusion and Solution

  1. Go to the path/to/pytorch directory.
    cd /path/to/pytorch
  2. Delete the sub-repository folder that fails to be downloaded.

    The error message contains the path of the sub-repository folder that fails to be downloaded. See the bold text in Symptom. Delete the folder.

    rm -rf /path/to/pytorch/third_party/ios-cmake
  3. Run the command again to obtain the sub-repository dependency.
    git submodule update --init --recursive