Remote branch 2.1.0 not found in upstream error while installing Pytorch 2.1.0 for Python version 3.9 from Build Source

Hi @dusty_nv ,

As per the below link:

I am trying to build pytorch with python 3.9 version from the source as we dont have ready made .whl file for python 3.9.

  1. Could please provide me .whl file for python 3.9 compatible with pytorch 2.1.0 for Jetpack 5.1.2,
    so that we can install it easily. As we getting below error when we try to follow the steps provided in the above link

root@linux:/usr/local/bin# git clone --recursive --branch 2.1.0 GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Cloning into ‘pytorch’…
warning: redirecting to GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration
fatal: Remote branch 2.1.0 not found in upstream origirch2:

How to fix this error?

  1. Also under the apply patches section from the above link, I dont see a patch for our Jetpack 5.1.2 version.
    Kindly provide the patch for Jetpack 5.1.2 to be applied as part of installation step.

Apply Patch
Select the patch to apply from below based on the version of JetPack you’re building on. The patches avoid the “too many CUDA resources requested for launch” error (PyTorch issue #8103 , in addition to some version-specific bug fixes.

Hi,

Currently, we only provide the package for the default Python version.
For JetPack 5.1.2, it’s Python 3.8 so please build it from the source if Python 3.9 is required.

Please update the download command to the below:

$ git clone --recursive --branch v2.1.0 https://github.com/pytorch/pytorch

Thanks.

Thanks for the updates.
I will use this updated command.

What about the next step after this which talks about some Apply patches to avoid error.
I won’t see any entry for Jetpack 5.1.2 patch?

Could.you please clarify about the same.

Hi,

No patch is required for the v2.1.0 PyTorch branch.

Please see the patch for JetPack 5.0 here.
The change is to add the Orin GPU architecture into the supported_arches.

But in the v2.1.0 branch, the Orin GPU architecture (8.7) is by default added.
So no extra patch is required to build it for Jetson.

Thanks.

Thanks for the clarification.

Also, Before installing this Pytorch v 2.1.0 with Python 3.9, I will uninstall my previous Pytorch v2.1.0 with Python 3.8, I had installed with the available wheel file as per the thread( Which provides pytorch installation steps).

The command to uninstall completely and safely so that, it wont effect other related software components is:


> $ sudo pip3 uninstall -y torch

Please confirm, if this uninstallation command is fine, or should we do some purging or manually delete some folders to completely remove the pytorch related folders.

Thanks.

Hi,

Yes, the uninstallation command should work.
We also list the same way in our document below:

https://docs.nvidia.com/deeplearning/frameworks/install-pytorch-jetson-platform/index.html#uninstall

Thanks.

1 Like

@AastaLLL
I executed below commands:

**$ git clone --recursive --branch v2.1.0 GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration **
$ cd pytorch
//Set Build Options
$ export USE_NCCL=0
$ export USE_DISTRIBUTED=0 # skip setting this if you want to enable OpenMPI backend
$ export USE_QNNPACK=0
$ export USE_PYTORCH_QNNPACK=0
$ export TORCH_CUDA_ARCH_LIST=“5.3;6.2;7.2;8.7” # or “7.2;8.7” for JetPack 5 wheels for Xavier/Orin
$ export PYTORCH_BUILD_VERSION=2.1.0 # without the leading ‘v’, e.g. 1.3.0 for PyTorch v1.3.0
$ export PYTORCH_BUILD_NUMBER=1

Build wheel for Python 3.9 (to pytorch/dist)

$ sudo apt-get install python3-pip cmake libopenblas-dev libopenmpi-dev
$ pip3 install -r requirements.txt
$ pip3 install scikit-build
$ pip3 install ninja

$ python3.9 setup.py bdist_wheel

But I am getting below error for the last command “$ python3.9 setup.py bdist_wheel” as per the steps provided in the link:

root@linux:/home/cabs-willet/Downloads/pytorch# python3.9 setup.py bdist_wheel
Building wheel torch-2.1.0
Traceback (most recent call last):
File “/home/cabs-willet/Downloads/pytorch/setup.py”, line 339, in
cmake = CMake()
File “/home/cabs-willet/Downloads/pytorch/tools/setup_helpers/cmake.py”, line 40, in init
self._cmake_command = CMake._get_cmake_command()
File “/home/cabs-willet/Downloads/pytorch/tools/setup_helpers/cmake.py”, line 67, in _get_cmake_command
raise RuntimeError(“no cmake or cmake3 with version >= 3.18.0 found”)
RuntimeError: no cmake or cmake3 with version >= 3.18.0 found

Pls let us know how to fix these errors and successfully install pytorch for python3.9

Also there was a new requirement from customer to install MiniConda/Conda

I installed MiniConda. Is it due that it is referring to 3.18 version?
How to uninstall MiniConda just in case if that is the issue?

@AastaLLL

Pls reply to the above query.

I tried downloading cmake 3.19 version… tweaking some errors for CUDA.make and tried completing all the steps.

But when I checked with “pip show torch”
Says pytorch not found.

Pls let me know how to resolve these issues

@AastaLLL

I am getting the below error when trying to install the .whl file that was generated for python3.9:

root@linux:/home/cabs-willet/Downloads/pytorch/dist# pip3 install numpy torch-2.1.0-cp39-cp39-linux_aarch64.whl
ERROR: torch-2.1.0-cp39-cp39-linux_aarch64.whl is not a supported wheel on this platform.

Pls let us know how to fix this.

Hi,

cmake can be installed with the below command:

$ sudo apt-get install -y protobuf-compiler libprotobuf-dev openssl libssl-dev libcurl4-openssl-dev
$ wget https://github.com/Kitware/CMake/releases/download/v3.22.0/cmake-3.22.0.tar.gz
$ tar xvf cmake-3.22.0.tar.gz
$ cd cmake-3.22.0/
$ ./bootstrap --system-curl
$ make -j$(nproc)
$ sudo make install

Do you build the python3.9 on your own?
Or download it from the web?

Thanks.

1 Like

Thanks a lot for these steps to build cmake 3.22 even though bit late. I will document this and try out later in case it is needed.
I was able to install cmake 3.20 by following these steps some how by fixing so many errors related to CUDA later on:

apt-get update && apt-get upgrade -y

sudo apt-get install build-essential libssl-dev

cd /tmp

wget

https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0.tar.gz

tar -zxvf cmake-3.20.0.tar.gz

cd cmake-3.20.0

#./bootstrap

make

sudo make install

cmake --version

I installed python 3.9 with this command, If I am not wrong and documented it properly.

$sudo apt-get install python3.9-dev

Hope it is fine,

Hi,

Sorry, the question is not clear enough.

Is the Pytorch package for Python 3.9 built by yourself or downloaded from the website?
Since online packages are usually not built with CUDA support.

root@linux:/home/cabs-willet/Downloads/pytorch/dist# pip3 install numpy torch-2.1.0-cp39-cp39-linux_aarch64.whl
ERROR: torch-2.1.0-cp39-cp39-linux_aarch64.whl is not a supported wheel on this platform.

Based on the error, could you check if the below command helps?

Thanks.

It was built by myself.During to be this process I got some error related to CUDA saying two versions of CUDA etc, I resolved those by editing the corresponding config files and proceed further to complete the build and installation finally.

That is my post only. After linking the python to 3.9 version Pytorch wheel file got installed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.