3

I am using the opencv-python project here. What I would like to do is recreate the wheel file again. So what I did was something like:

python setup.py bdist_wheel

This creates a dist directory and adds the wheel file there which I then take and try to install in an Anaconda environment as follows:

pip install ~/opencv_python-3.4.2+5b36c37-cp36-cp36m-linux_x86_64.whl

This is fine and seems to install fine. But when I try to use it and do

import cv2

I get the error:

ImportError: libwebp.so.5: cannot open shared object file: No such file or directory

I thought that creating the wheel file would take care of all the dependencies but I wonder if I have to do something else before the wheel generation to make sure everything is packaged correctly?

EDIT

I compare the wheel archives from the official sources and the one I generated and I see that the third party libraries are not included. So, my zip file contents are:

['cv2/LICENSE-3RD-PARTY.txt', 
 'cv2/LICENSE.txt', 'cv2/__init__.py', 
 'cv2/cv2.cpython-36m-x86_64-linux-gnu.so']

I have omitted some XML files which are not relevant. Meanwhile, the official archive has:

['cv2/__init__.py', 
 'cv2/cv2.cpython-36m-i386-linux-gnu.so', 
 'cv2/.libs/libswresample-08248319.so.3.2.100', 
 'cv2/.libs/libavformat-d485f70f.so.58.17.101', 
 'cv2/.libs/libvpx-1b5256ac.so.5.0.0', 
 'cv2/.libs/libz-83853723.so.1.2.3', 
 'cv2/.libs/libQtGui-55070e59.so.4.8.7', 
 'cv2/.libs/libavcodec-3b67922d.so.58.21.104', 
 'cv2/.libs/libswscale-3bf29a6c.so.5.2.100', 
 'cv2/.libs/libQtTest-0cf8861e.so.4.8.7', 
 'cv2/.libs/libQtCore-ccf6d197.so.4.8.7', 
 'cv2/.libs/libavutil-403a4871.so.56.18.102']
Luca
  • 10,458
  • 24
  • 107
  • 234
  • I would say giving instructions about neccesary system libraries (such as libwebp-dev) is correct way instead of trying to packet everything, but I am not sure so will wait for a better answer. – unlut Sep 04 '18 at 13:34
  • @unlut But the whole point of the wheel is to package the dependencies, as far as I understand, so one can install it easily? – Luca Sep 04 '18 at 13:51
  • Only python dependencies, not system libraries. – phd Sep 04 '18 at 14:29
  • @phd So how come the official one does have the system libs packaged? I am trying to generate the same wheel file at the moment from the original setup sources. – Luca Sep 04 '18 at 14:41
  • 1
    https://stackoverflow.com/a/42106034/7976758 – phd Sep 04 '18 at 16:57
  • @phd This opens a whole other can of worms where I have to build opencv on this really old linux – Luca Sep 05 '18 at 15:39

0 Answers0