Installing Python 3.8 on Ubuntu 18 for Hue

You must install Python 3.8 on all hosts after installing Cloudera Manager and before adding the services to your cluster.

Install the necessary developer tools such as gcc and make on your system.

Install the following packages before installing Python 3.8:
  • build-essential
  • zlib1g-dev
  • libssl-dev
  • libffi-dev
  • libbz2-dev
sudo apt install -y build-essential zlib1g-dev libssl-dev libffi-dev libbz2-dev
  1. SSH into the host system as a root user.
  2. Download Python 3.8 and decompress the package by running the following commands:
    cd /opt
    curl -O https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz
    tar -zxvf Python-3.8.12.tgz
  3. Change directory to where you decompressed the Python 3.8 package:
    cd /opt/Python-3.8.12
  4. Install Python 3.8 as follows:
    ./configure --enable-shared --prefix=[***CUSTOM-INSTALL-PATH***]
    The --enabled-shared option is used to build a shared library instead of a static library.
  5. Build Python 3.8 as follows:
    1. Run the make command to compile the files:
      make
    2. Run the following command to put the compiled files in the default location or in the custom location that you specified using the --prefix option:
      make install
    3. Copy the shared compiled library files (libpython3.8.so) to the /lib64/ directory:
      cp --no-clobber ./libpython3.8.so* /lib64/
      The --no-clobber option is used to prevent overwriting files.
    4. Change the permissions of the libpython3.8.so files as follows:
      chmod 755 /lib64/libpython3.8.so*
    If you see an error such as error while loading shared libraries: libpython3.8.so.1.0: cannot open shared object file: No such file or directory, then run the following command:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
(For Hue) If you have installed Python 3.8 at a custom location, then you must append the custom path in Cloudera Manager > Clusters > Hue > Configuration > Hue Service Environment Advanced Configuration Snippet (Safety Valve) separated by colon (:) as follows after adding the Hue service:

Key: PATH

Value: [***CUSTOM-INSTALL-PATH***]:/usr/local/sbin:/usr/local/bin:/usr/sbin: