Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, I am using pypmml in a docker in a lambda and its giving me a java error. #55

Open
4qmbjamil opened this issue Nov 2, 2023 · 1 comment

Comments

@4qmbjamil
Copy link

4qmbjamil commented Nov 2, 2023

I am writing the below docker code:

FROM public.ecr.aws/lambda/python:3.9

# Install OpenJDK Java 8
RUN yum -y install java-1.8.0-openjdk

# Setting java home
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.382.b05-1.amzn2.0.2.x86_64
ENV PATH "$PATH:$JAVA_HOME/bin"

# copy all the directories in the root folder for lambda function
COPY . ${LAMBDA_TASK_ROOT}

# install python dependencies
COPY requirements.txt .
RUN pip3 install --upgrade pip && pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"

# see https://docs.aws.amazon.com/lambda/latest/dg/troubleshooting-deployment.html#troubleshooting-deployment-denied
RUN chmod 644 $(find . -type f) && chmod 755 $(find . -type d)

# Invoke Lambda
CMD [ "lambda_function.lambda_handler" ]

I am also defining the JAVA_HOME path also in lambda function, but i still am facing error when i use pypmml. Below is the error which i get:

[DEBUG] 2023-11-02T16:11:50.262Z 1f5d2fe4-ed9f-402e-acb6-4993c9982cbe Launching gateway with command ['/usr/lib/java-1.8.0-openjdk-1.8.0.382.b05-1.amzn2.0.2.x86_64/bin/java', '-classpath', '/var/task/py4j/../share/py4j/py4j0.10.9.7.jar:/var/task/pypmml/jars/*', 'py4j.GatewayServer', '--die-on-broken-pipe', '0']

[ERROR] 2023-11-02T16:11:50.266Z 1f5d2fe4-ed9f-402e-acb6-4993c9982cbe [Errno 2] No such file or directory: '/usr/lib/java-1.8.0-openjdk-1.8.0.382.b05-1.amzn2.0.2.x86_64/bin/java'

@scorebot
Copy link
Member

scorebot commented Nov 3, 2023

Based on the error message above, can you double check if the path /usr/lib/java-1.8.0-openjdk-1.8.0.382.b05-1.amzn2.0.2.x86_64 exists within your docker? pypmml depends on py4j to invoke java code from python, it always looks up the java command from $JAVA_HOME/bin/java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants