0

For a Django Python project, I develop in a Docker container. The oscrypto Python package I need is unable to find the Libcrypto library on the Ubuntu container. The Docker image is ubuntu:24.04.

I am using:

Python 3.11.14 (main, Oct 10 2025, 08:54:04) [GCC 13.3.0] on linux 

When I try:

>>> from oscrypto import asymmetric 

I get the following error:

 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/root/.local/share/virtualenvs/cartell_django-ZK37DTUr/lib/python3.11/site-packages/oscrypto/asymmetric.py", line 19, in <module> from ._asymmetric import _unwrap_private_key_info File "/root/.local/share/virtualenvs/cartell_django-ZK37DTUr/lib/python3.11/site-packages/oscrypto/_asymmetric.py", line 27, in <module> from .kdf import pbkdf1, pbkdf2, pkcs12_kdf File "/root/.local/share/virtualenvs/cartell_django-ZK37DTUr/lib/python3.11/site-packages/oscrypto/kdf.py", line 9, in <module> from .util import rand_bytes File "/root/.local/share/virtualenvs/cartell_django-ZK37DTUr/lib/python3.11/site-packages/oscrypto/util.py", line 14, in <module> from ._openssl.util import rand_bytes File "/root/.local/share/virtualenvs/cartell_django-ZK37DTUr/lib/python3.11/site-packages/oscrypto/_openssl/util.py", line 6, in <module> from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error File "/root/.local/share/virtualenvs/cartell_django-ZK37DTUr/lib/python3.11/site-packages/oscrypto/_openssl/_libcrypto.py", line 9, in <module> from ._libcrypto_cffi import ( File "/root/.local/share/virtualenvs/cartell_django-ZK37DTUr/lib/python3.11/site-packages/oscrypto/_openssl/_libcrypto_cffi.py", line 44, in <module> raise LibraryNotFoundError('Error detecting the version of libcrypto') oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto 

For compatibility reasons, we use Python 3.11, so I had to install it within the development container.

This is the Ubuntu Dockerfile for reference:

FROM ubuntu:24.04 RUN apt update -y \ && apt install -y git \ && apt install -y sudo \ && sudo apt-get install -y software-properties-common RUN sudo add-apt-repository ppa:deadsnakes/ppa -y \ && sudo apt update -y RUN sudo apt install -y python3.11-full \ && sudo apt install -y pip pipenv RUN echo "alias python=python3.11" >> ~/.bashrc 

OpenSSL is installed, and I can find a libcrypto.so file within the Ubuntu container:

root@f8f281d06280:/# which openssl /usr/bin/openssl root@f8f281d06280:/# find . -type f -name "libcrypto.*" ./usr/lib/aarch64-linux-gnu/libcrypto.so.3 

The oscrypto docs only had extra info about OpenSSL/Libcrypto configurations for Alpine Linux, but I am using Ubuntu

Where is oscrypto expecting to find the libcrypto library and can I just make a symlink to where it wants it, to where the file actually exists? Or is there a better solution entirely?

2
  • 1
    You haven't shown anything about how you're installing oscrypto. You do mention some docs, but don't link to any. Please include the actual steps used for installing in the question. Commented Dec 5 at 14:18
  • seconding @muru's concern here. The oscrypto library you're using might simply have been built against a different, incompatible version of libcrypto, as far as we know! Commented Dec 5 at 15:06

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.