0

出于某种原因,我无法在 Jupyter Docker 容器中运行 SAS 笔记本。我可以通过 saspy 在Python笔记本中运行 SAS 代码,但 SAS 内核不断向我抛出错误。

我使用图像 jupyter/pyspark-notebook:notebook-6.4.2 作为基础,并通过 IOM 连接到远程服务器。如果我运行 Python 笔记本,例如

import saspy
%reload_ext saspy.sas_magic
ss = saspy.SASsession(cfgname="xxx")

然后连接工作正常。有时它会超时,但这可能是服务器问题。

但是,如果我运行 SAS 笔记本,当我尝试提交代码块时,我会得到一个错误结果:

[<class 'TypeError'>, TypeError("Frame 0 ({'shell': [b'f8fd30a1-60bc-4f25-...) does not support the buffer interface."), <traceback object at 0x7fad01e41100>]

运行容器的终端窗口中还有一堆错误信息:

notebook_1  | [I 17:14:56.181 NotebookApp] Kernel started: 58182c39-9df4-4922-b068-1d6bde76c31a, name: sas
notebook_1  | [IPKernelApp] ERROR | Exception in message handler:
notebook_1  | Traceback (most recent call last):
notebook_1  |   File "/opt/conda/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 352, in dispatch_shell
notebook_1  |     await result
notebook_1  |   File "/opt/conda/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 642, in execute_request
notebook_1  |     reply_content = self.do_execute(
notebook_1  |   File "/opt/conda/lib/python3.9/site-packages/metakernel/_metakernel.py", line 397, in do_execute
notebook_1  |     retval = self.do_execute_direct(code)
notebook_1  |   File "/opt/conda/lib/python3.9/site-packages/sas_kernel/kernel.py", line 213, in do_execute_direct
notebook_1  |     res = self.mva.submit(code, prompt=self.promptDict)
notebook_1  | AttributeError: 'NoneType' object has no attribute 'submit'

dockerfile 旨在在公司防火墙后面使用,因此包含一些机密条目,因此很难给出可重现的示例。但它的要点是:

FROM jupyter/pyspark-notebook:notebook-6.4.2

RUN mamba install -c conda-forge -y nodejs && \
    conda clean --all -f -y && \
    fix-permissions $CONDA_DIR && \
    fix-permissions /home/$NB_USER

RUN pip install jupyterlab_templates &&\
    jupyter labextension install jupyterlab_templates && \
    jupyter serverextension enable --py jupyterlab_templates

RUN pip install pytest sas_kernel

# Adding SAS config
ADD saspy/*.jar /opt/conda/lib/python3.9/site-packages/saspy/java/
ADD saspy/sascfg_personal.py /opt/conda/lib/python3.9/site-packages/saspy/

一些特定版本:

Python 3.9.6

jupyter core     : 4.7.1
jupyter-notebook : 6.4.2
qtconsole        : not installed
ipython          : 7.26.0
ipykernel        : 6.0.3
jupyter client   : 6.1.12
jupyter lab      : 3.1.4
nbconvert        : 6.1.0
ipywidgets       : 7.6.3
nbformat         : 5.1.3
traitlets        : 5.0.5

sas-kernel                2.4.11
saspy                     3.7.5  

我怎样才能解决这个问题?

4

0 回答 0