Tengerye
Tengerye

Reputation: 1964

opencv import error (libopencv_dnn.so.3.4 undefined symbol)

System information:

Ubuntu 16.04, Anaconda 1.6.9, Python 3.6.4, libopencv 3.4.1, opencv 3.4.1, py-opencv 3.4.1.

Problem definition: I just upgraded my opencv to 3.4 through anaconda and found could not import.

The import error is:

ImportError: anaconda3/lib/python3.6/site-packages/../../libopencv_dnn.so.3.4: undefined symbol: _ZNK6google8protobuf7Message25InitializationErrorStringB5cxx11Ev

Upvotes: 3

Views: 4839

Answers (2)

Tengerye
Tengerye

Reputation: 1964

The following solution works for me, although not sure why and how.

  1. conda install -c defaults libprotobuf protobuf
  2. conda install -c menpo opencv3

Upvotes: 4

Alex W
Alex W

Reputation: 38253

Have you tried this answer from GitHub:

  1. Configure /usr/local/cuda/include/host_config.h as suggested. (remove the gcc 5 error from the CUDA header host_config.h)
  2. sudo apt-get autoremove libprotobuf-dev protobuf-compiler
  3. then compile the protobuf-2.5.0 from src and install Please config the gcc when you compile protobuf ./configure --prefix=/usr/local/ CC=/usr/bin/gcc

Also (GitHub user groakat mentions):

for me this problem was caused because I had protobuf installed in anaconda. If you have protobuf installed in your anaconda environment, you have to remove all files by hand, as conda uninstall protobuf does not remove all the library files.

Upvotes: 0

Related Questions