misp-modules icon indicating copy to clipboard operation
misp-modules copied to clipboard

misp-modules v2.4.195 importlib.import_module("cv2") fails

Open github-germ opened this issue 2 years ago • 17 comments

What can be done to prevent this error from occurring when launching misp-modules v2.4.165 with MISP v2.4.167?

ERROR:root:libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/misp_modules/__init__.py", line 41, in <module>
    from .modules import *  # noqa
  File "/usr/local/lib/python3.8/site-packages/misp_modules/modules/__init__.py", line 1, in <module>
    from .expansion import *  # noqa
  File "/usr/local/lib/python3.8/site-packages/misp_modules/modules/expansion/qrcode.py", line 3, in <module>
    import cv2
  File "/usr/local/lib/python3.8/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/usr/local/lib/python3.8/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
uwhois module not installed.

github-germ avatar Jan 04 '23 19:01 github-germ

not seeing this anymore in 2.4.169

github-germ avatar Mar 16 '23 18:03 github-germ

Seeing this again in 2.4.195...

[20240815-170828] /entrypoint.sh starting
ERROR:root:libGL.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/misp_modules/__init__.py", line 45, in <module>
    from .modules import *  # noqa
  File "/usr/local/lib/python3.8/site-packages/misp_modules/modules/__init__.py", line 1, in <module>
    from .expansion import *  # noqa
  File "/usr/local/lib/python3.8/site-packages/misp_modules/modules/expansion/qrcode.py", line 3, in <module>
    import cv2
  File "/usr/local/lib/python3.8/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/usr/local/lib/python3.8/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

github-germ avatar Sep 27 '24 15:09 github-germ

Try a more recent version.

ostefano avatar Sep 27 '24 15:09 ostefano

Thx for the swift reply. 2.4.195 is pretty recent. You think this is fixed in 2.4.197?

github-germ avatar Sep 27 '24 16:09 github-germ

I have good reasons to think so

ostefano avatar Sep 27 '24 17:09 ostefano

OK, I cannot hit 2.4.197 yet, as I have to revise my Dockerfile as <= 2.4.195 I built using REQUIREMENTS which is no longer. On my first revised attempt it built a bogus docker image. I'll get back to that over the next week or so.

github-germ avatar Sep 27 '24 18:09 github-germ

Why don't you try the official docker image? https://github.com/MISP/misp-docker

Also, you can now install misp-modules using pip: https://pypi.org/project/misp-modules/

ostefano avatar Sep 27 '24 19:09 ostefano

Hey everyone,

I have installed 2.4.199 on a ubuntu 24.04.1. I also had the problem with libgl1.so.1

I just found a post in another project and they said: install libgl1 so i did a sudo apt-get install libgl1 and that fixed the test through misp-modules -t

so maybe it needs to be written in the docs for a dependency

s-karberg avatar Jan 17 '25 07:01 s-karberg

Good point 👍

ostefano avatar Jan 17 '25 08:01 ostefano

Hey everyone,

I have installed 2.4.199 on a ubuntu 24.04.1. I also had the problem with libgl1.so.1

I just found a post in another project and they said: install libgl1 so i did a sudo apt-get install libgl1 and that fixed the test through misp-modules -t

so maybe it needs to be written in the docs for a dependency

How did you install it?

ostefano avatar Jan 17 '25 08:01 ostefano

Hey everyone, I have installed 2.4.199 on a ubuntu 24.04.1. I also had the problem with libgl1.so.1 I just found a post in another project and they said: install libgl1 so i did a sudo apt-get install libgl1 and that fixed the test through misp-modules -t so maybe it needs to be written in the docs for a dependency

How did you install it?

install what? misp-modules?

s-karberg avatar Jan 17 '25 08:01 s-karberg

Yes, how did you install misp-modules?

ostefano avatar Jan 17 '25 09:01 ostefano

Asking because the documentation (https://misp.github.io/misp-modules/install/) specifies the following steps:

Note that the dependencies will require a number of system packages installed. On Ubuntu these packages are libpoppler-cpp-dev, libzbar0, and tesseract-ocr. For an updated list, check the github action used to test the build inside .github/workflows.

And I wonder wether libgl1 might be a dependency of one of those packages.

ostefano avatar Jan 17 '25 09:01 ostefano

Yes, how did you install misp-modules?

i have "tried" both way. pip install misp-modules but i can see it also had the git clone way.

regarding the system packages, i looked in that and workflows, the libgl1 package is not listed in there :)

s-karberg avatar Jan 17 '25 13:01 s-karberg

@s-karberg yes, I know, I am asking whether you tried to install libpoppler-cpp-dev, libzbar0, and tesseract-ocr as specified in the readme, since libgl1 might actually be a dependency (let's just say that I have a strong feeling that is the case).

ostefano avatar Jan 17 '25 13:01 ostefano

@s-karberg yes, I know, I am asking whether you tried to install libpoppler-cpp-dev, libzbar0, and tesseract-ocr as specified in the readme, since libgl1 might actually be a dependency (let's just say that I have a strong feeling that is the case).

i did, didn't work :) they are installed.

s-karberg avatar Jan 17 '25 13:01 s-karberg

In that case I agree we need to add it to the readme :)

I wonder why the CI/CD doesn't break though, that is weird. Would you be open to adding a test to reproduce the issue at test time?

ostefano avatar Jan 17 '25 14:01 ostefano