objectbox/objectbox-python

Problem when running inside container

abhipsb opened this issue · 1 comments

Hi,
I have created a python container image as below and copy my code files in it
FROM python:3.10-alpine3.14
WORKDIR /home
COPY ./*.py ./
RUN chmod 755 -R .
RUN apk update
RUN apk upgrade
RUN apk add py-pip gcompat
RUN python -m pip install --upgrade pip
RUN pip install --upgrade objectbox

But the python code is not able to run inside the container as shows below error:
/home # python app.py
Traceback (most recent call last):
File "/home/app.py", line 5, in
import objectbox
File "/usr/local/lib/python3.10/site-packages/objectbox/init.py", line 16, in
from objectbox.box import Box
File "/usr/local/lib/python3.10/site-packages/objectbox/box.py", line 16, in
from objectbox.model.entity import _Entity
File "/usr/local/lib/python3.10/site-packages/objectbox/model/init.py", line 16, in
from objectbox.model.entity import *
File "/usr/local/lib/python3.10/site-packages/objectbox/model/entity.py", line 17, in
from objectbox.c import *
File "/usr/local/lib/python3.10/site-packages/objectbox/c.py", line 46, in
C = ctypes.CDLL(lib_path)
File "/usr/local/lib/python3.10/ctypes/init.py", line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: Error relocating /usr/local/lib/python3.10/site-packages/objectbox/lib/x86_64/libobjectbox.so: pthread_getname_np: symbol not found

I searched but could not find any solution, seems like some package/library missing ... please help!

I'm now able to run the code inside container.
So, rather than using alpine I used Debian based base image and changed my Dockerfile as below:
FROM python:3.10-slim
WORKDIR /home
COPY ./*.py ./
RUN chmod 755 -R .
RUN apt-get update
RUN python -m pip install --upgrade pip
RUN pip install --upgrade objectbox

With this it's working now! Hence closing this issue