Giter Club home page Giter Club logo

Comments (7)

dacort avatar dacort commented on July 30, 2024 2

Confirmed that if you want to work around this, it's possible with a custom image. This is the Dockerfile I used for EMR 7:

FROM --platform=linux/amd64 public.ecr.aws/emr-serverless/spark/emr-7.0.0:latest
USER root

RUN dnf install python3.11

WORKDIR /tmp
RUN jar xf /usr/lib/livy/repl_2.12-jars/livy-repl_2.12-0.7.1-incubating.jar fake_shell.py && \
    sed -ie 's/version < \"3\.8\"/version_info < \(3,8\)/' fake_shell.py && \
    jar uvf /usr/lib/livy/repl_2.12-jars/livy-repl_2.12-0.7.1-incubating.jar fake_shell.py
WORKDIR /home/hadoop

ENV PYSPARK_PYTHON=/usr/bin/python3.11

USER hadoop:hadoop

I've also opened/bumped an internal ticket for this issue.

from emr-serverless-samples.

hendrikmuhs avatar hendrikmuhs commented on July 30, 2024 1

Yeah, was thinking the same. Thanks for the gist, this makes it easier for me!

from emr-serverless-samples.

dacort avatar dacort commented on July 30, 2024 1

Updated the doc in https://github.com/aws-samples/emr-serverless-samples/tree/main/examples/pyspark/custom_python_version with examples for both EMR 6.x and 7.x and a note about Python >= 3.10. Closing this for now.

from emr-serverless-samples.

hendrikmuhs avatar hendrikmuhs commented on July 30, 2024

I've spotted the bug, it is caused by a badly patched livy. This change does not exist in the original version.

AWS engineering has patched this file as follows:

                if sys.version < "3.8":
                    mod = ast.Module([node])
                else:
                    mod = ast.Module([node], [])

for 3.10, 3.11 < "3.8" returns True 🤦

This bad code can be found on line 222 of fake_shell.py, which is part of emr-serverless-livy, which is part of the amazons EMR image.

I could not find a corresponding repository, probably this sits in a private fork of AWS. I unfortunately don't know how to file a bug against that repo.

@dacort can you help?

from emr-serverless-samples.

dacort avatar dacort commented on July 30, 2024

Hi @hendrikmuhs - Thanks for opening this issue and digging in to find the issue. Livy definitely is problematic for python versions >3.8. We've fixed that to some extent in EMR, but not for Python >=3.10 as you've pointed out.

I'll have to look into where that is with EMR Serverless and/or what options there are. You can't unfortunately run your own Jupyter server at this time to connect to EMR-S.

One quick question - when you mention emr-serverless-livy - where did you see that package?

from emr-serverless-samples.

hendrikmuhs avatar hendrikmuhs commented on July 30, 2024

@dacort thanks for the quick feedback

Repo steps:

Pull the official AWS EMR image and run a shell:

docker run --user root -it --entrypoint /bin/bash public.ecr.aws/emr-serverless/spark/emr-7.0.0

In the shell:

bash-5.2# dnf list --installed emr-serverless-livy
Installed Packages
emr-serverless-livy.noarch                                                 0.7.1-1.amzn2023                                                  @System

The file in question is part of a jar:

bash-5.2# dnf repoquery --installed -l emr-serverless-livy

You get to the code when you unzip this file from the package:

unzip /usr/lib/livy/repl_2.12-jars/livy-repl_2.12-0.7.1-incubating.jar

from emr-serverless-samples.

dacort avatar dacort commented on July 30, 2024

@hendrikmuhs Awesome, thank you!

While I'm repro'ing on my side, you could try patching the fake_shell.py in that jar and see if it helps. I have an example of doing that, although it's for an older version of Livy (and EMR on EC2) so the patch file itself probably wouldn't work. But gives a script to unpack/patch/pack the jar back up. https://gist.github.com/dacort/df1fba8b1e0cc7ef341d713e25ebf1a4

from emr-serverless-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.