Installing pip utility with INZA Python

This document describes the process of installing pip utility for INZA Python 2.7 64-bit language, provided as part of the IBM Netezza Analytics package.

Before you begin

Ensure that the following products are installed on system.

  • IBM Netezza Analytics package of 11.0.x.
  • OpenSSL version 1.0.2x
Note:

The defects for any Python third-party library are not addressed.

Vulnerabilities can only be fixed by the Python third party.

This procedure only provides a way of installing third-party libraries and is not supported by IBM.

Procedure

  1. Pip installation:

    The pip utility is not provided by default with Python 2.7. It must be installed on both the host and SPU side. Use commands to perform the installation on the host and SPU side, respectively.

    • Host: /nz/export/ae/languages/python/2.7/host64/bin/python -m ensurepip --default-pip
    • SPU: /nz/export/ae/languages/python/2.7/spu64/bin/python -m ensurepip --default-pip

    This installs pip and pip2 utility at /nz/export/ae/languages/python/2.7/host64/bin/ and /nz/export/ae/languages/python/2.7/spu64/bin/, respectively.

    Note: The utility needs to be installed for both host and SPU python language. The pip utility requires an SSL library for proper functioning, which is not provided with Python 2.7 host64 and spu64 language.
  2. SSL workaround:

    The pip requires SSL to install third-party libraries. The SSL library is not currently provided with spu64 and host Python 2.7 language. This step provides a workaround to access SSL library from python executables.

    1. Copy the attached library _ssl.so_host64 as _ssl.so at /nz/export/ae/languages/python/2.7/host64/lib/python-link/lib-dynload/ location and _ssl.so_spu64 as _ssl.so at /nz/export/ae/languages/python/2.7/spu64/lib/python-link/lib-dynload/ location, respectively.
      Note: The SSL libraries provided have dependency on system OpenSSL, whose version should be minimum 1.0.2. Any lower version than this is not supported.
    2. Confirm if the SSL is compatible by trying to import the SSL library as import ssl from /nz/export/ae/languages/python/2.7/host64/bin/python and /nz/export/ae/languages/python/2.7/spu64/bin/python executables.
    • /nz/export/ae/languages/python/2.7/host64/bin/python -c import ssl
    • /nz/export/ae/languages/python/2.7/spu64/bin/python -c import ssl

    If an error occurs regarding version compatibility, you must update OpenSSL packages to version 1.0.2.

  3. Install third-party libraries:

    The workaround in step 2 provides the necessary SSL library to pip. Now use the following command to install any third-party library by using pip:

    • Host: /nz/export/ae/languages/python/2.7/host64/bin/pip install <library_name>
    • SPU: /nz/export/ae/languages/python/2.7/spu64/bin/pip install <library_name>
      • Note that every library needs to be installed on both the host and SPU side. All these libraries are downloaded and installed at /nz/export/ae/languages/python/2.7/host64/lib/python-link/site-packages and /nz/export/ae/languages/python/2.7/spu64/lib/python-link/site-packages for host and SPU, respectively. Also, ensure that the SSL library is renamed to _ssl.so after copying them at the mentioned location.

    Python 3.6 comes with the default pip, which you can find at the following location:

    • Host: /nz/export/ae/languages/python/3.6/host64/bin/pip3
    • SPU: /nz/export/ae/languages/python/3.6/spu64/bin/pip3

Example

The following is an example of pip execution.


/nz/export/ae/languages/python/2.7/spu64/bin/pip install camelcase
Collecting camelcase
  Using cached https://files.pythonhosted.org/packages/24/54/6bc20bf371c1c78193e2e4179097a7b779e56f420d0da41222a3b7d87890/camelcase-0.2.tar.gz
Installing collected packages: camelcase
  Running setup.py install for camelcase ... done
Successfully installed camelcase-0.2
You are using pip version 9.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/nz/export/ae/languages/python/3.6/spu64/bin/pip3 install camelcase
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting camelcase
  Using cached https://files.pythonhosted.org/packages/24/54/6bc20bf371c1c78193e2e4179097a7b779e56f420d0da41222a3b7d87890/camelcase-0.2.tar.gz
Installing collected packages: camelcase
  Running setup.py install for camelcase ... done
Successfully installed camelcase-0.2
You are using pip version 9.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

What to do next

Find the following SSL library for python 2.7:

For version 3.x, the following file is to be copied in at:
  • Host: /nz/export/ae/languages/python/3.6/host64/lib/python3.6/lib-dynload/
  • SPU: /nz/export/ae/languages/python/3.6/spu64/lib/python3.6/lib-dynload/
Keep the file name as is, do not change it. Once done, run the following commands:
  • Run /nz/export/ae/languages/python/3.6/host64/bin/python3.6 -c import ssl
  • Run /nz/export/ae/languages/python/3.6/spu64/bin/python3.6 -c import ssl