1

I am trying to run my test cases in Bitbucket-pipeline but it is showing an error message.

Screenshot of Bitbucket-pipeline.yml

enter image description here

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   import cv2
E   ImportError: libopencv_hdf.so.3.1: cannot open shared object file: No such file or directory

**ImportError**
Rajat jain
  • 1,715
  • 3
  • 12
  • 21
  • 1
    Welcome to Stack Overflow! Please do not use images to convey textual information. [Edit] your question to replace them with the respective code. Additionally, questions seeking debugging help ("**why isn't this code working?**") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Without this, your question is off-topic and liable to be closed. Please construct a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and include it. – Tim Diekmann May 26 '18 at 11:50

3 Answers3

1

You could didn't install opencv3.1 or didn't install correctly that's why you can't import it.

  • `- /opt/python/bin/conda install seaborn opencv=3.1.0 scipy libgcc boost=1.61.0 libpng=1.6.27 cython` This is my dependency for pipeline.. – Rajat jain May 28 '18 at 06:56
1

Thanks, I found the answer. I was installing opencv redundant time, so it was overlapping and deleting some important module from itself. This is my script from Bitbucket-pipeline.yml

    image: python:3.6.2
pipelines:
  default:
    - step:
        caches:
          - condacache
        script:
          - wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
          - chmod +x Miniconda3-latest-Linux-x86_64.sh
          - ./Miniconda3-latest-Linux-x86_64.sh -u -b -p /opt/python
          - cd marvin_oms
          - /opt/python/bin/conda update -y conda
          - /opt/python/bin/pip install --upgrade pip
          - /opt/python/bin/conda install -y numpy pandas SQLAlchemy requests lxml  virtualenv psycopg2
          - apt-get update && apt-get install -y libzbar0 libzbar-dev libgtk2.0-0
          - /opt/python/bin/pip install pyzbar
          - /opt/python/bin/conda install seaborn opencv=3.1.0 scipy libgcc boost=1.61.0 libpng=1.6.27 cython
          - /opt/python/bin/pip install libraries/imgforensics-0.1-cp36-cp36m-linux_x86_64.whl
          - /opt/python/bin/pip install -r requirements.txt
          - /opt/python/bin/pytest

definitions:
  caches:
    condacache: /opt/python/bin
Rajat jain
  • 1,715
  • 3
  • 12
  • 21
1

that's because you might have pasted another cv2.so file which is overlapping go ahead and open a terminal and type

cd /lib/python3/dist-packages
and then
ls

you will see cv2.so , copy it on desktop as a backup so incase if i am wrong you won't lose it

type :

cp cv2.so /home/ubuntu/cv2.so

and then type this to delete it

rm cv2.so

now type

python3
import cv2

and you're done ...

a proof of concept :

check here the image

and after deleting it :

last one after importing

Umair Ali
  • 33
  • 7