on 2021 Jul 29 1:23 PM
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.
Request clarification before answering.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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'
User | Count |
---|---|
77 | |
30 | |
10 | |
8 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.