Rate This Document
Findability
Accuracy
Completeness
Readability

Basic Installation

The basic installation procedure of PyTorch includes obtaining the source code and sub-repository dependency code, setting environment variables, and compiling and installing PyTorch. Replace the example paths provided in the following procedure with the actual ones.

  1. Configure a git network proxy.
    git config --global http.sslVerify false 
    git config --global https.sslverify false 
    git config --global http.proxy "http://Username:Password@Proxy_IP_address:Proxy_port"
  2. Obtain the PyTorch source code.
    git clone -b v2.1.2 https://github.com/pytorch/pytorch.git --depth 1
  3. Go to the /path/to/pytorch directory.
    cd /path/to/pytorch
  4. Obtain the sub-repository dependency code.
    git submodule sync 
    git submodule update --init --recursive
  5. Set environment variables.
    export USE_CUDA=0 
    export USE_ROCM=0 
    export USE_FBGEMM=0 
    export USE_GLOO=0

    USE_CUDA: CUDA is a technology dedicated to NVIDIA GPUs. Set this parameter to 0 in CPU scenarios, meaning that this optional is disabled.

    USE_ROCM: ROCM is a technology dedicated to AMD GPUs. Set this parameter to 0 in CPU scenarios, meaning that this optional is disabled.

    USE_FBGEMM: Matrix operation acceleration library, which applies only to x86. Set this parameter to 0 in Arm scenarios, meaning that this optional is disabled.

    USE_GLOO: Communication library between multiple GPUs and multiple nodes. Set this parameter to 0 in CPU scenarios, meaning that this optional is disabled.

  6. Install the Python dependency.
    pip install -r requirements.txt
  7. Compile and install PyTorch.
    python3 setup.py install
  8. Verify the installation.
    pip list | grep torch