Python Installation on Linux - Redhat/CentOS

Python is only needed if you need to use Python and the PySpark engine in Fire Insights. Python modules in Fire Insights use Python 3.7+.

Check if Python 3.7+ is Installed

Use the below commands:

python --version
python3.7 --version

Install Python 3.7 (if not installed)

Some References for Installing Python:

Prerequisites

Python installation requires the GCC compiler to be available on the machine. Use the following command to install the prerequisites for installing Python.

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

Download and extract the downloaded package

Download and untar:

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xzf Python-3.7.0.tgz

Compile Python source code

Compile the Python source code on your system using altinstall:

cd Python-3.7.0
./configure --enable-optimizations
make altinstall
python3.7 –-version
Installations

Create Python virtual environment & Activate it

Create Python virtual environment & Activate it:

python3.7 -m venv venv
source venv/bin/activate
python --version
Installations
Installations

Upgrade pip version

Upgrade pip version with 20.0 or above:

pip install pip --upgrade
Installations

Install dependency for fbprophet package (CentOS 7)

Run below command with sudo privilege

  • Install development tool:

    yum install -y xz-devel
    
Installations
  • Install the CentOS SCL release file:

    yum install centos-release-scl
    
Installations
  • Install Developer Toolset version 7:

    yum install devtoolset-7
    
Installations
  • launch a new shell instance using the Software Collection scl tool & Check GCC version:

    scl enable devtoolset-7 bash
    gcc --version``
    
Installations
  • Install fbprophet package:

    pip install fbprophet
    
Installations
  • Check pip list:

    pip list
    
Installations

Install Other Packages

Install the required packages:

cd fire-x.y.x/dist/fire
pip install -r requirements.txt

requirements.txt file is available in the installation directory of fire insights:

fire-x.y.x/dist/fire/requirements.txt

Reference

Delete a venv

To delete a virtual environment, follow below steps:

source venv/bin/activate
pip freeze > requirements.txt
pip uninstall -r requirements.txt -y
deactivate
rm -r venv/

Installing pip & wheel

Add below in .bash_profile

  • export PYSPARK_PYTHON=/usr/bin/python3
  • export PYSPARK_DRIVER_PYTHON=/usr/bin/python3