cancel
Showing results for 
Search instead for 
Did you mean: 

Import sapdi in python operator with existing docker image

0 Kudos
553

Hello Community,

I already have one docker file grouped to the python operator. I have tried creating a new docker file for sapdi as mentioned in one of the questions but it's not working.

Docker File 1:

# Use an official Python 3.6 image as a parent image 
FROM python:3.6
# Install python libraries
RUN pip install pandas
RUN pip install numpy
RUN pip install sklearn
RUN pip install catboost
RUN pip install pgeocode
RUN pip install hdfs==2.5.0
RUN pip install tornado==5.0.2
# Add vflow user and vflow group to prevent error 
# container has runAsNonRoot and image will run as root
RUN groupadd -g 1972 vflow && useradd -g 1972 -u 1972 -m vflow
USER 1972:1972
WORKDIR /home/vflow
ENV HOME=/home/vflow
Tags for this Docker file:
{
    "python36": "",
    "tornado": "5.0.2",
    "hdfs": "2.5.0",
    "module": ""
}

Docker File 2:

https://answers.sap.com/questions/13285803/import-sapdi-library-in-python-operator-of-sap-di.html

Have used this to build second docker file for sapdi.

Then have attached both the tags to the python operator, but it's not working.

Any help would be appreciated!

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

AndreasForster
Product and Topic Expert
Product and Topic Expert

Hi Sumit, I have just had a look at the DockerFiles that come with DI and com.sap.dsp.dsp-core-operators has a sapdi tag. It was only a quick test, but with this Docker I was able to import sapdi in a Python operator

FROM $com.sap.dsp.dsp-core-operators
RUN pip3.6 install --user numpy=="1.16.1"
0 Kudos

Thanks Andreas,

This is working fine.

Answers (1)

Answers (1)

AndreasForster
Product and Topic Expert
Product and Topic Expert

Hello sumitguha , You need to create a single DockerFile that contains all the libraries required for the code in your Python operator. It's been working well for me to base the DockerFile on an image provided by DI and to install the additional libraries. Something like

FROM $com.sap.sles.base
RUN pip3.6 install --user numpy=="1.16.1"
0 Kudos

Hello Andreas,

Thanks for your reply, have tried this but it's not working.

Below is the docker file & Tags in the JSON file:

# Use an official Python 3.6 image as a parent image
FROM $com.sap.sles.base
# Install python libraries
RUN pip3.6 install --user numpy
RUN pip3.6 install --user pandas
RUN pip3.6 install --user sklearn
RUN pip3.6 install --user catboost
RUN pip3.6 install --user pgeocode
RUN pip3.6 install --user hdfs==2.5.0
RUN pip3.6 install --user tornado==5.0.2
{
    "python36": "",
    "tornado": "5.0.2",
    "hdfs": "2.5.0",
    "sapdi": "",
    "module": ""
}

The build is complete of this docker file

But the code is showing the below error:

No module named 'sapdi'