Python Configuration

Gathr supports Python 3.11.13. To support Python 3.11.13, configure as mentioned below:

Install Required Packages

  • Use the following command to install prerequisites for Python before installing it.
$ yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel xz-devel gcc openssl-devel bzip2-devel libffi-devel zlib-devel  python3-devel krb5-devel gcc -y
$ yum groupinstall "Development Tools" -y
  • If above command is not working use the below command:
$ yum install @development  
  • Download Python 3.11.13

  • Download Python using the following command from the Python official site. You can also download the latest version instead of the one specified below.

$ cd /tmp
$ wget https://www.python.org/ftp/python/3.11.13/Python-3.11.13.tgz

  • Now extract the downloaded package:
$ tar xzf Python-3.11.13.tgz

  • Compile Python Source.

Use the following set of commands to compile the Python source code on the system using altinstall.

$ cd Python-3.11.13
$ ./configure
$ make
$ make altinstall

  • Check Python Version

Check the latest version of Python installed with the following command:

$ python3.11 -V

  • Create Soft links for python and pip

Run the following command to create a soft link so that the default python3 points to python3.11:

$ ln -sf /usr/local/bin/python3.11 /usr/bin/python3
$ ln -sf /usr/local/bin/python3.11 /bin/python3
$ ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3
$ ln -sf /usr/local/bin/python3.11 /opt/python3
$ ln -sf /usr/local/bin/pip3.11 /usr/bin/pip3

This completes the installation of Python 3.11 on the system.

  • Upgrade pip package. (Optional)
$ /usr/local/bin/python3.11 -m pip install --upgrade pip

  • Install Python libraries on the nodes. (Optional)
$ pip3 install --no-cache-dir joblib==1.5.1 numpy==2.3.1 pandas==2.3.1 scikit-learn==1.7.1 requests==2.32.4 hdfs==2.7.3

Troubleshooting

ERROR 1

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/python/WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/python/

ERROR 2

Could not build the ssl module! Python requires a OpenSSL 1.1.1 or newer

Install required dependencies(minimum)

sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel

Download and compile OpenSSL 1.1

cd /usr/local/src
sudo wget https://www.openssl.org/source/openssl-1.1.1l.tar.gz
sudo tar xzf openssl-1.1.1l.tar.gz
cd openssl-1.1.1l
sudo ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib
sudo make
sudo make install

Download and install Python 3.11

cd Python-3.11.16
sudo ./configure --with-openssl=/usr/local/openssl --enable-optimizations
sudo make
sudo make install

Download and install Python 3.11

cd Python-3.11.16
sudo ./configure --with-openssl=/usr/local/openssl --enable-optimizations
sudo make
sudo make install

Top