0

I am using streamlit and lightgbm with docker and I am currently getting this error.

OSError: libgomp.so.1: cannot open shared object file: No such file or directory

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/src/stream.py", line 6, in <module>
    model = pickle.load(open('model.pkl', 'rb'))
  File "/usr/local/lib/python3.10/site-packages/lightgbm/__init__.py", line 8, in <module>
    from .basic import Booster, Dataset, Sequence, register_logger
  File "/usr/local/lib/python3.10/site-packages/lightgbm/basic.py", line 110, in <module>
    _LIB = _load_lib()
  File "/usr/local/lib/python3.10/site-packages/lightgbm/basic.py", line 101, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "/usr/local/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/usr/local/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)

I tried updating my Dockerfile to include libgomp1 alongside the other dependencies listed in this solution: https://stackoverflow.com/a/73140670/14651739

My dockerfile

FROM ubuntu:latest
WORKDIR /src/
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        ca-certificates \
        cmake \
        build-essential \
        gcc \
        g++ \
        git && \
    rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get -y install curl

RUN apt-get install libgomp1 -y
    # apt-get install curl 

FROM python:3.10.0-slim-buster

WORKDIR /src

COPY requirements.txt /src/

COPY --from=0 /src ./
RUN pip3 install -r requirements.txt

EXPOSE 8501

COPY . /src/
ENTRYPOINT ["streamlit", "run"]
CMD [ "stream.py" ]

My requirements.txt file

pandas
sklearn
streamlit
lightgbm

0 Answers0