Rate This Document
Findability
Accuracy
Completeness
Readability

Failed to Obtain the Dependency of the Sub-repository

Symptom

The message "fatal: clone of 'xxx' into submodule path 'xxx' failed." is displayed when the sub-repository dependency is obtained. The details are as follows:

Cloning into '/path/to/pytorch/third_party/cub'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining error: 1501 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet fatal: early EOF
fatal: fetch-pack: invalid index-pack output
fatal: clone of 'https://github.com/NVlabs/cub.git' into submodule path '/home/pytorch/third_par ty/cub' failed
Failed to clone 'third party/cub'. Retry scheduled 

Or

fatal: unable to access 'https://gitlab.com/libeigen/eigen.git/': error:1408F10B:SSL routines:ssl3_get_record:wrong version number
fatal: clone of 'https://gitlab.com/libeigen/eigen.git' into submodule path '/home/pytorch/third_party/eigen' failed

Key Process and Cause Analysis

Sub-repository dependency download fails due to network problems.

Conclusion and Solution

Method 1:

Go to the path/to/pytorch directory and obtain the sub-repository dependency again.

1
2
cd /path/to/pytorch
git submodule update --init --recursive

Method 2:

If the sub-repository cannot be obtained using method 1, manually download the dependency, upload it to the server, and specify the local directory of the sub-repository. The following uses the eigen sub-repository as an example:

  1. Run the following command on a computer that can access https://gitlab.com/libeigen/eigen.git to obtain the code:
    1
    git clone https://gitlab.com/libeigen/eigen.git
    
  2. Upload the downloaded code to the /path/to/eigen directory on the server.
  3. Go to the pytorch directory and query the module name of the sub-repository.
    1
    2
    cd /path/to/pytorch
    cat .gitmodules | grep eigen
    

    The query result is as follows, where third_party/eigen is the module name.

    [submodule "third_party/eigen"]
        path = third_party/eigen
        url = https://gitlab.com/libeigen/eigen.git
  4. Specify the local path of the third_party/eigen submodule.
    1
    git config submodule.third_party/eigen.url /path/to/eigen
    
  5. Obtain the sub-repository again.
    1
    git submodule update --init --recursive