Python guide
E-MapReduce (EMR) uses Python 3.6.4. Depending on your EMR version, Python 3.6.4 may already be installed, or you may need to install it manually on the master node.
Check your EMR version
Python 3.6.4 is installed by default on:
-
EMR V2.10.0 and later 2.X.X versions
-
EMR V3.10.0 and later 3.X.X versions
The default installation directory is /usr/bin/python3.6. No further action is required.
Manual installation is required on:
-
EMR V2.X.X earlier than V2.10.0
-
EMR V3.X.X earlier than V3.10.0
If your cluster runs one of these older versions, follow the steps below to install Python 3.6.4 from source on the master node.
Install Python 3.6.4
Perform this installation on the master node only.
Prerequisites
Before you begin, make sure you have:
-
Access to the master node of your EMR cluster. For instructions, see Log on to a cluster.
-
An SFTP client (such as SSH Secure File Transfer Client) to upload files to the master node.
Download and upload the package
-
Download Python-3.6.4.tgz from the Python website.
-
Use your SFTP client to upload
Python-3.6.4.tgzto the/usr/localdirectory on the master node.
Build and install Python
Log on to the master node, then run the following commands in order.
-
Create the installation directory.
sudo mkdir -p /usr/local/python3 -
Decompress the package.
tar zxvf Python-3.6.4.tgz -
Configure the build with the installation path.
cd Python-3.6.4 ./configure --prefix=/usr/local/python3 -
Compile and install.
make && make install -
Create a symbolic link so that
python3resolves to the installed binary.ln -s /usr/local/python3/bin/python3 /usr/bin/python3
Verify the installation
Run the following commands to confirm that Python 3.6.4 and pip3 are installed correctly.
Check Python:
python3 -V
Expected output:
Python 3.6.4
Check pip3:
pip3 -V
Expected output:
pip 9.0.1 from /usr/local/Python-3.6.4/lib/python3.6/site-packages (python 3.6)