Caffe2: make ops fails when installing densepose

518 Views Asked by At

I am trying to install DensePose but run into problems when executing make ops.

First I get error Caffe2Config.cmake not found, but after following the instructions here Caffe2 build from source the Caffe2Config.cmake ends up under the build directory.

Adding the path to the build folder gives then the following error:

  CMake Error at /home/erikbylow/Code/LocalLibs/pytorch/build/Caffe2Config.cmake:14 (include):
  include could not find load file:

    /home/erikbylow/Code/LocalLibs/pytorch/build/public/utils.cmake
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)


CMake Error at /home/erikbylow/Code/LocalLibs/pytorch/build/Caffe2Config.cmake:17 (include):
  include could not find load file:

    /home/erikbylow/Code/LocalLibs/pytorch/build/public/threads.cmake
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)


CMake Error at /home/erikbylow/Code/LocalLibs/pytorch/build/Caffe2Config.cmake:88 (include):
  include could not find load file:

    /home/erikbylow/Code/LocalLibs/pytorch/build/public/cuda.cmake
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)

The paths are clearly wrong since the requested cmake-files are under pytorch/cmake/public instead of pytorch/build/public.

How can one resolve that? I have just followed the instructions and the tests one makes along the way works. It seems to be the installation of Caffe2 that causes the problem?

1

There are 1 best solutions below

0
On

In my case, setting the environment variable Caffe2_DIR to the directory of the missing files solved the problem.

As you mentioned, these files are in the pytorch/cmake/public directory instead of pytorch/build/public. To define the path of Caffe2 manually, open the CMakeLists.txt in the densepose folder, add one line in the beginning:

set(Caffe2_DIR "/home/erikbylow/Code/LocalLibs/pytorch/cmake/")

Run make ops again and the issue should be solved. If not, also try

set(Caffe2_DIR "/home/erikbylow/Code/LocalLibs/pytorch/torch/share/cmake/Caffe2/")

Also, after DensePose is successfully installed, remember to append its path to PYTHONPATH:

export PYTHONPATH=$PYTHONPATH:/path/to/densepose/