Search code examples
pytorch

Pytorch - building from source - CMAKE_BUILD_WITH_INSTALL_RPATH


I am building PyTorch from source as my GPU card is not supported by the packages in pip or conda.

I am in Ubuntu 20.04. I followed the instructions at :

I get this error. I searched the internet but there are no useful pointers.

There are numerous errors like below:

CMake Error at modules/observers/CMakeLists.txt:12 (add_library):
  The install of the caffe2_observers target requires changing an RPATH from
  the build tree, but this is not supported with the Ninja generator unless
  on an ELF-based platform.  The CMAKE_BUILD_WITH_INSTALL_RPATH variable may
  be set to avoid this relinking step.

Any idea how this could be resolved. I already tried setting up an environment variable as below but it did not help.

$ export CMAKE_BUILD_WITH_INSTALL_RPATH=On
$ echo ${CMAKE_BUILD_WITH_INSTALL_RPATH}
On

Solution

  • I found that installing cmake solves the problem.

    sudo apt install cmake
    

    I could not debug why it worked. I was in ubuntu version 20.04. May be it had a cmake that was too old and running the above command fetches the latest version.

    I thought this is still a useful information for someone facing the same issues - so, noting down here.