sberbank-ai-lab / LightAutoML

LAMA - automatic model creation framework
Apache License 2.0
887 stars 92 forks source link

Error on Import #53

Closed PGijsbers closed 2 years ago

PGijsbers commented 3 years ago

With the latest version, after installing I always get an error on first import:

>>> import lightautoml
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/venv/lib/python3.9/site-packages/lightautoml/__init__.py", line 19, in <module>
    from .automl.presets import *
  File "/venv/lib/python3.9/site-packages/lightautoml/automl/presets/image_presets.py", line 17, in <module>
    from ...pipelines.features.image_pipeline import ImageSimpleFeatures, ImageAutoFeatures
  File "/venv/lib/python3.9/site-packages/lightautoml/pipelines/features/image_pipeline.py", line 12, in <module>
    from ...transformers.image import ImageFeaturesTransformer, AutoCVWrap
  File "/venv/lib/python3.9/site-packages/lightautoml/transformers/image.py", line 15, in <module>
    from ..image.image import CreateImageFeatures, DeepImageEmbedder
  File "/venv/lib/python3.9/site-packages/lightautoml/image/image.py", line 6, in <module>
    import cv2
  File "/venv/lib/python3.9/site-packages/cv2/__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

It seems to be an issue with opencv-python and requires an install of the python3-opencv package (apt-get install -y python3-opencv). Making the CV part of LAMA an optional install, or at least adding this to the documentation would be helpful.

alexmryzhkov commented 3 years ago

Hi @PGijsbers,

Many thanks to let us know the issue.

Could you also tell us how it works before and stop working now? Maybe you have changed the start env or server OS or whatever? It can help us to define properly when to use the install because not always you have sudo rights on the servers..

Alex

PGijsbers commented 3 years ago

I'm sorry, I don't know about any of that. I observed the issue running the benchmark script (in docker and on aws), I hadn't personally ran the framework before so I can't tell when the issues started or which version changed happened since. It does happen on the latest generic python docker image as well:

C:\Users\Work>docker run -it --entrypoint=/bin/bash python
root@0589c73becc1:/# pip install lightautoml
...
root@0589c73becc1:/# python
Python 3.9.6 (default, Jul 22 2021, 15:16:20)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lightautoml
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/lightautoml/__init__.py", line 19, in <module>
    from .automl.presets import *
  File "/usr/local/lib/python3.9/site-packages/lightautoml/automl/presets/image_presets.py", line 17, in <module>
    from ...pipelines.features.image_pipeline import ImageSimpleFeatures, ImageAutoFeatures
  File "/usr/local/lib/python3.9/site-packages/lightautoml/pipelines/features/image_pipeline.py", line 12, in <module>
    from ...transformers.image import ImageFeaturesTransformer, AutoCVWrap
  File "/usr/local/lib/python3.9/site-packages/lightautoml/transformers/image.py", line 15, in <module>
    from ..image.image import CreateImageFeatures, DeepImageEmbedder
  File "/usr/local/lib/python3.9/site-packages/lightautoml/image/image.py", line 6, in <module>
    import cv2
  File "/usr/local/lib/python3.9/site-packages/cv2/__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
>>>
alexmryzhkov commented 3 years ago

@PGijsbers could you tell the version of pip? Have you done beforehand pip install -U pip in your script?

PGijsbers commented 3 years ago

Above was generated with pip 21.1.3. Doing it again but updating pip to 21.2.1 beforehand gives the same result.

PGijsbers commented 3 years ago

FWIW the python docker container is built on Debian:

root@e354ce99b560:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
github-actions[bot] commented 2 years ago

Stale issue message