-
Hi team, File "/home/dsci/classifier-api/app/core/middleware.py", line 13, in <module>
import memray
File "/venv/lib/python3.9/site-packages/memray/__init__.py", line 2, in <module>
from ._memray import AllocationRecord
ImportError: cannot import name 'AllocationRecord' from 'memray._memray' (unknown location) My base image(referred as FROM google-gcr.artifactory.cicd.dc/distroless/python3-debian11 AS runtime
COPY --from=build-parent /venv /venv
COPY --from=build-parent /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
COPY --from=build-parent /home/dsci /home/dsci
COPY --from=build-parent /usr/local/lib/python3.9/dist-packages /venv/lib/python3.9/site-packages
WORKDIR /home/dsci/classifier-api/app
ENTRYPOINT ["/venv/bin/python", "entrypoint.py"] Both base image and distroless image are based on debian11 and uses python3.9. Any idea what might be the issue and how to resolve it (library imports, path variables etc.)? P.S. I see that AllocationRecord in present as a struct in struct AllocationRecord
{
uintptr_t address;
size_t size;
hooks::Allocator allocator;
}; I'm wondering why error is called (unknown location)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
You already asked this in #629 and I answered it there. You're trying to use a library built for Python 3.9 with a 3.11 interpreter. That will not work. You need to use Python 3.11 to install the package in the
It's telling you that it went looking for a module named |
Beta Was this translation helpful? Give feedback.
I see: your
_memray.*.so
is called_memray.cpython-39-x86_64-linux-gnu.so
, but your Python is looking for_memray.cpython-39-aarch64-linux-gnu.so
. It appears that you copied x86-64 executable code from your base image into an aarch64 distroless image. That's why it's not working: an aarch64 (ARM) Python can't import modules built for x86_64 (Intel).