0

On my Ubuntu 16.04, I have installed OpenCV for python from the Ubunto repos using the command

sudo apt-get python-opencv

This installs the required libopencv-core2.4v5 and related packages & Python libraries via the dependencies.

When I try to import the cv2 from Python, I get the following error:

$ python
Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/lib/x86_64-linux-gnu/libavutil.so.52: version `LIBAVUTIL_52' not found (required by /usr/local/lib/libopencv_highgui.so.2.4)
>>>

This should work out-of-the box. I have tried to install various combinations of extra packages from the repo without much luck.

/usr/lib/x86_64-linux-gnu/libavutil.so.52 appears to be a symbolic link:

$ ls -l /usr/lib/x86_64-linux-gnu/libavutil.so.52
lrwxrwxrwx 1 root root 38 Oct 26  2015 /usr/lib/x86_64-linux-gnu/libavutil.so.52 -> /usr/lib/x86_64-linux-gnu/libavutil.so

I wonder if anyone has seen this before and/or have any recommendations as to how I can resolve this. I have some faces, that needs detection :)

4
  • 1
    You may refer to stackoverflow.com/questions/40128751/… Commented Nov 21, 2016 at 19:13
  • I had a feeble hope that it wasn't necessary, since it's all part of the official Ubuntu repo, but I'd like to get running, so I'll try that. Thanks. Commented Nov 21, 2016 at 20:13
  • 1
    Do you have multiple installations of Python? Another possibility is that you are running a python different from which opencv is associated to. Commented Nov 22, 2016 at 2:07
  • I don't think that the python version is the issue @pyan, since python finds the module, but the loading fails because of a library that has the wrong version. Commented Nov 22, 2016 at 6:30

1 Answer 1

1

I used the script provided in How to install openCV 2.4.13 for Python 2.7 on Ubuntu 16.04? as suggested by @pyan, which solved my problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.