facebookresearch / DensePose

A real-time approach for mapping all human pixels of 2D RGB images to a 3D surface-based model of the body
http://densepose.org
Other
6.98k stars 1.3k forks source link

make ops failing (Could not find a package "Caffe2") #70

Open rainerkohlberger opened 6 years ago

rainerkohlberger commented 6 years ago

make ops quits with the error below.

  CMake Error at CMakeLists.txt:8 (find_package):
  By not providing "FindCaffe2.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Caffe2", but
  CMake did not find one.

  Could not find a package configuration file provided by "Caffe2" with any
  of the following names:

   Caffe2Config.cmake
   caffe2-config.cmake

  Add the installation prefix of "Caffe2" to CMAKE_PREFIX_PATH or set
  "Caffe2_DIR" to a directory containing one of the above files.  If "Caffe2"
  provides a separate development package or SDK, be sure it has been
  installed.

Caffe2Config.cmake is present in the following directories:

./anaconda2/envs/deep/share/cmake/Caffe2/Caffe2Config.cmake ./anaconda2/share/cmake/Caffe2/Caffe2Config.cmake ./anaconda2/pkgs/caffe2-cuda8.0-cudnn7-0.8.dev-py36_2018.05.14/share/cmake/Caffe2/Caffe2Config.cmake ./anaconda2/pkgs/caffe2-cuda9.0-cudnn7-0.8.dev-py36_2018.07.17/share/cmake/Caffe2/Caffe2Config.cmake ./anaconda2/pkgs/caffe2-cuda8.0-cudnn7-0.8.dev-py27_2018.05.14/share/cmake/Caffe2/Caffe2Config.cmake ./anaconda2/conda-bld/caffe2-cuda9.0-cudnn7_1531845329467/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/share/cmake/Caffe2/Caffe2Config.cmake ./anaconda2/conda-bld/caffe2-cuda9.0-cudnn7_1531845329467/work_moved_caffe2-cuda9.0-cudnn7-0.8.dev-py36_2018.07.17_linux-64/build/Caffe2Config.cmake ./anaconda2/conda-bld/caffe2-cuda9.0-cudnn7_1531846730247/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/share/cmake/Caffe2/Caffe2Config.cmake ./anaconda2/conda-bld/caffe2-cuda9.0-cudnn7_1531846730247/work_moved_caffe2-cuda9.0-cudnn7-0.8.dev-py36_2018.07.17_linux-64/build/Caffe2Config.cmake

Tried setting CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH to all of them, without success ( I also tried compiling Caffe2 myself).

Both python2-commands from the install guide to test Caffe2 are successful.

What to do, so cmake will find Caffe2 and compile ops correctly in anaconda? Thanks!!

vkhalidov commented 6 years ago

Have you tried setting Caffe2_DIR?

rainerkohlberger commented 6 years ago

Yes I tried settings Caffe2_DIR with the following command to any of the directories where Caffe2Config.cmake is present. None of them works.

export Caffe2_DIR=/media/dev/anaconda2/share/cmake/Caffe2

rainerkohlberger commented 6 years ago

As I have to run the build with sudo, I just realised that environment variables aren't found running sudo without -E flag. Seems it compiled now!

vkhalidov commented 6 years ago

you should specify those as CMake variables, not environment variables, i.e. you should run the CMake command as cmake .. -DCaffe2_DIR=path/to/Caffe2Config.cmake

rainerkohlberger commented 6 years ago

Thanks! It all compiled, but when running the test_zero_even_op.py command I get the following error:

Traceback (most recent call last):
  File "/media/dev/densepose/detectron/tests/test_zero_even_op.py", line 117, in <module>
    c2_utils.import_custom_ops()
  File "/media/dev/densepose/detectron/utils/c2.py", line 40, in import_custom_ops
    dyndep.InitOpsLibrary(custom_ops_lib)
  File "/media/dev/anaconda2/lib/python2.7/site-packages/caffe2/python/dyndep.py", line 35, in InitOpsLibrary
    _init_impl(name)
  File "/media/dev/anaconda2/lib/python2.7/site-packages/caffe2/python/dyndep.py", line 48, in _init_impl
    ctypes.CDLL(path)
  File "/media/dev/anaconda2/lib/python2.7/ctypes/__init__.py", line 366, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /media/dev/densepose/build/libcaffe2_detectron_custom_ops_gpu.so: undefined symbol: _ZN6google8protobuf8internal9ArenaImpl28AllocateAlignedAndAddCleanupEmPFvPvE

I had to remove and reinstall protobuf before (sudo apt-get install libprotobuf-dev protobuf-compiler), also tried reinstalling in anaconda (conda install -c conda-forge libprotobuf).

Do I have to specify a custom path to protobuf for cmake as well? Or what could be the problem now?

Edit: I also got this warning when compiling, might be related? CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA.cmake:1649 (add_library): Cannot generate a safe runtime search path for target caffe2_detectron_custom_ops_gpu because files in some directories may conflict with libraries in implicit directories:

runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /media/dev/anaconda2/envs/deep/lib

Some of these libraries may not be found correctly. Call Stack (most recent call first): CMakeLists.txt:45 (CUDA_ADD_LIBRARY)

vkhalidov commented 6 years ago

The undefined symbol error is caused by different coexisting versions of protobuf. If you installed Caffe2 from the pytorch repository, it is likely to contain its own protobuf. So I would suggest to compile and link caffe2_detectron_custom_ops_gpu against protobuf fromPyTorch.

rainerkohlberger commented 6 years ago

I installed Caffe2 via conda install -c caffe2 caffe2-cuda8.0-cudnn7. cmake I run with cmake .. -DCaffe2_DIR=/media/dev/anaconda2/envs/deep/share/cmake/Caffe2. How to remove all other versions of protobuf to make sure it uses the right one? Thanks!

rainerkohlberger commented 6 years ago

If I run the build again by setting the Caffe2 path to the other directory where Caffe2Config.cmake is present ( cmake .. -DCaffe2_DIR=/media/dev/anaconda2/pkgs/caffe2-cuda8.0-cudnn7-0.8.dev-py27_2018.05.14/share/cmake/Caffe2 ) I get the following error multiple times:

/media/dev/anaconda2/pkgs/caffe2-cuda8.0-cudnn7-0.8.dev-py27_2018.05.14/include/caffe2/proto/caffe2.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^

There seems to be a bigger problem with protobuf on my system, is there a good way to clean install protobuf so the build accepts the right version? Or to specify which one to use? Thanks

vkhalidov commented 6 years ago

You should first determine which protoc was used for Caffe2. Then locate all protobuf instances (you can use locate or find). Depending on how protobuf was installed, you can try uninstalling it (e.g. apt-get remove --purge libprotobuf-dev protobuf-compiler)

vkhalidov commented 6 years ago

To use a particular protoc, you can try playing with PATH env variable. But first you need to determine which protobuf / protoc you want to use.

rainerkohlberger commented 6 years ago

Somehow it successfully built now. But running infer_simple.py example, I'm getting the following error:

import detectron.utils.cython_nms as cython_nms
ImportError: /media/dev/densepose/detectron/utils/cython_nms.so: undefined symbol: PyFPE_jbuf

I tried uninstalling and reinstalling cython via pip and conda, without success. What could be the problem now?

vkhalidov commented 6 years ago

You need to check similar problems, e.g. https://github.com/scikit-learn/scikit-learn/issues/7542 These are typically caused by 2 concurrent environments

LDVC124 commented 6 years ago

@rainerkohlberger Can you provide more details about how did you pass the test_zero_even_op.py test? I was stuck in this part. Any advice would be helpful, thanks

rainerkohlberger commented 6 years ago

@LDVC124 ended up using Docker

jaggernaut007 commented 6 years ago

Same here. Docker images save time

On Mon, 17 Sep 2018, 3:04 pm Rainer Kohlberger, notifications@github.com wrote:

@LDVC124 https://github.com/LDVC124 ended up using Docker

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/facebookresearch/DensePose/issues/70#issuecomment-421944138, or mute the thread https://github.com/notifications/unsubscribe-auth/Al5HtM9A2ZI8ikIHpRBTMsBOvIPSiWw5ks5ub2ycgaJpZM4VTRLY .

roboticlemon commented 6 years ago

Same @LDVC124 I just reinstalled my cuda and had to recompile and now it doesnt work. Any solution to the densepose/build/libcaffe2_detectron_custom_ops_gpu.so: undefined symbol: _ZN6google8protobuf8internal9ArenaImpl28AllocateAlignedAndAddCleanupEmPFvPvE issue??

gf0507033 commented 6 years ago

@vkhalidov I have clear ubuntu installation with no protobuf except one in third_party/protobuf. For sake of sanity I've installed python protobuf from third_party/protobuf/python (not from pip). I got the same error as @ingramator and @LDVC124 with symbol _ZN6google8protobuf8internal9ArenaImpl28AllocateAlignedAndAddCleanupEmPFvPvE. I've tried recipe from Protobuf problems -- no effect.

BhaskarNallani commented 6 years ago

Installed caffe2 with pytorch. I am getting the same issue. An update on issue?

roboticlemon commented 6 years ago

@BhaskarNallani @gf0507033 @jaggernaut007 @LDVC124 There is a workaround suggested by @hyounsamk at issue #119 I have posted my working cmakelist and instructions!

SaeedSaadatnejad commented 6 years ago

I have the same problem (make ops fails) and it didn't solve by: cmake .. -DCaffe2_DIR=path/to/Caffe2Config.cmake

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

Any suggestion?

gaowenwen1101 commented 6 years ago

I installed Caffe2 via conda install -c caffe2 caffe2-cuda8.0-cudnn7. cmake I run with cmake .. -DCaffe2_DIR=/media/dev/anaconda2/envs/deep/share/cmake/Caffe2. How to remove all other versions of protobuf to make sure it uses the right one? Thanks!

@rainerkohlberger Hello,I met the same problem with you and install caffe2 by conda as well.How to solve it ?How to remove all protocals?Do I hvae to rebuild caffe2 after removing all versions of protocal?Thank you very much.

The issue is here: /home/iot/miniconda2/include/caffe2/proto/caffe2.pb.h:17:2: error: #error This file was generated by an older version of protoc which is

error This file was generated by an older version of protoc which is

^ /home/iot/miniconda2/include/caffe2/proto/caffe2.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please

error incompatible with your Protocol Buffer headers. Please

^ /home/iot/miniconda2/include/caffe2/proto/caffe2.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.

error regenerate this file with a newer version of protoc.

pjavia-iterativescopes commented 5 years ago

I am facing the similar issues there are many Caffe2Config.cmake files and and the one that is generated in build folder does not have relative path correct. The one in the torch/share folder has correct relative path. But then still there is some problem in including folders. In short the relative paths are messed up. This is a serious bug. Please guide.

jaggernaut007 commented 5 years ago

Why don't you use docker instead? Life is easy with dockerfiles

On Sat, 5 Jan 2019, 12:30 am Peri Javia <notifications@github.com wrote:

I am facing the similar issues there are many Caffe2Config.cmake files and and the one that is generated in build folder does not have relative path correct. The one in the torch/share folder has correct relative path. But then still there is some problem in including folders. In short the relative paths are messed up. This is a serious bug. Please guide.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/facebookresearch/DensePose/issues/70#issuecomment-451536228, or mute the thread https://github.com/notifications/unsubscribe-auth/Al5HtM6N65ZEOOTCwtzUUJkfPgCPD8EYks5u_6TYgaJpZM4VTRLY .