Comments (7)
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.
Yeah, was thinking the same. Thanks for the gist, this makes it easier for me!
from emr-serverless-samples.
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.
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.
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.
@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.
@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)
- Version mismatch in 'airflow/setup.py' HOT 3
- 'template_fields' in 'EmrServerlessDeleteApplicationOperator' should be a tuple, not a string HOT 2
- EmrServerlessStartJobOperator does not raise airflow exception HOT 6
- Getting "No module named 'airflow.compat'" HOT 3
- configuration_overrides shouldn't be required
- Parameter countdown cannot be passed to EmrServerlessStartJobOperator HOT 4
- EMR serverless "java.lang.ClassNotFoundException" HOT 2
- Hive Example Fails when using JSON Data HOT 9
- [pyspark-dependencies] - DockerFile does not automatically move the tar.gz file to the local folder HOT 5
- Would it be possible to add 'config' to the list of template fields for EmrServerlessStartJobOperator? HOT 1
- EMR Serverless plugin in conflict with Airflow 2.2.2 constraints file HOT 15
- MWAA 2.2.2 constraints file HOT 1
- how to exec hive sql file with parameters HOT 1
- Add support for "config" to be a templated field in the EmrServerlessCreateApplicationOperator
- EMR Serverless Adding Option to Boto3 for Glue Catlog HOT 1
- Consider using Cloudwatch Variables for Application ID HOT 1
- ModuleNotFoundError when running sample code HOT 10
- virtualenv is not used when calling subprocess module
- providing extra jar file using --jars is not working for pyspark jobs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emr-serverless-samples.