sassoftware / python-swat

The SAS Scripting Wrapper for Analytics Transfer (SWAT) package is the Python client to SAS Cloud Analytic Services (CAS). It allows users to execute CAS actions and process the results all from Python.
Other
144 stars 61 forks source link

SWAT dependencies on OpenSSL libraries #148

Closed githje closed 1 year ago

githje commented 1 year ago

Hi,

it seems that SWAT (tested with release 1.12, both Python and R-SWAT) requires older versions of libcrypto.so and libssl.so which might no longer be shipped with recent Linux distros (my environment is a Ubuntu 22.04 LTS). This is probably the same issue as discussed here: https://github.com/sassoftware/python-swat/issues/106. Trying to initialize SWAT returns this error message in the notebook:

RuntimeError: Booting the TK subsystem failed: TKECERT: Extension load failure.

And:

ERROR: Could not load opensslcert extension. OpenSSL libraries are not found or the wrong version.

(found in the container log of the Jupyter notebook app). I was able to work around this issue by providing the required older library versions like this:

# extract *.so files from old openssl package
wget https://archlinux.org/packages/core/x86_64/openssl-1.1/download/ -O openssl-1.1-1.1.1.s-4-x86_64.pkg.tar.zst
tar --use-compress-program=unzstd -xvf openssl-1.1-1.1.1.s-4-x86_64.pkg.tar.zst
cp usr/lib/libcrypto.so.1.1 /usr/lib/x86_64-linux-gnu/
cp usr/lib/libssl.so.1.1 /usr/lib/x86_64-linux-gnu/

# set environment variables pointing to .so files in Jupyter config.
echo "os.environ[\"TKECERT_CRYPTO_LIB\"] = '/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1'" >> /etc/jupyter/jupyter_notebook_config.py
echo "os.environ[\"TKESSL_OPENSSL_LIB\"] = '/usr/lib/x86_64-linux-gnu/libssl.so.1.1'" >> /etc/jupyter/jupyter_notebook_config.py
githje commented 1 year ago

I'll close the track right away, as I only wanted to document the workaround in case others stumble across the same problem.

gygabyte017 commented 1 year ago

Hi, same happening to me now in k8s environment.

Using your idea, adding this to Dockerfile works:

# Force using old openssl package due to swat compatibility
RUN apt-get update && apt-get install -y zstd && rm -rf /var/lib/apt/lists/*
RUN wget https://archlinux.org/packages/core/x86_64/openssl-1.1/download/ -O openssl-1.1-1.1.1.s-4-x86_64.pkg.tar.zst
RUN tar --use-compress-program=unzstd -xvf openssl-1.1-1.1.1.s-4-x86_64.pkg.tar.zst
RUN cp usr/lib/libcrypto.so.1.1 /usr/lib/x86_64-linux-gnu/
RUN cp usr/lib/libssl.so.1.1 /usr/lib/x86_64-linux-gnu/

ENV TKECERT_CRYPTO_LIB=/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
ENV TKESSL_OPENSSL_LIB=/usr/lib/x86_64-linux-gnu/libssl.so.1.1