- Newest
- Most votes
- Most comments
The python environment that EMR notebook uses is /emr/notebook-env/bin/python
which is different from the default /usr/bin/python
. This is the reason why you might also observe the differences between the pip list
and !pip list
if we run from EMR notebook.
So as a next step:
-
you can install the python dependency from the EMR notebook manually. But this would be needed for each cluster.
-
In case you wish to automate the installation with the EMR, you can consider to use the below script ( replace the placeholder <packages> with the packages that are needed ), so that they get installed in both python environments:
#!/bin/bash
sudo pip3 install <packages>
sudo /emr/notebook-env/bin/pip install install <packages>
But the catch here is you need to use the delayed bootstrap action script so that once the EMR cluster comes into WAITING state, then after that the bootstrap action runs, see here - https://repost.aws/knowledge-center/emr-update-all-nodes-bootstrap . Delayed bootstrap action is needed because if we don't use delayed Bootstrap, by default when the bootstrap will run, the cluster won't find /emr/notebook-env
path and so Bootstrap will fail which will terminate the cluster.
You might already be aware that by default, the Bootstrap action runs before the application provisioning phase of the EMR cluster.
Relevant content
- asked 2 years ago
- How do I install and troubleshoot Python libraries in Amazon EMR and Amazon EMR Serverless clusters?AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 6 months ago