Installing a pip package in an offline Windows environment

Install Jupyter Notebook Server, including the additional pip package, without internet access.

About this task

When installing Jupyter Notebook Server, you may have additional packages listed within additional_pip_packages.txt. This task requires internet access, which in some cases might not be available. So you need to download the package before installing Jupyter.

Procedure

  1. Locate the tar.gz file for your specific package online, and download it.

    The Python Package Index (PyPI) pypi.org (https://pypi.org) website can be used to download most pip packages from the source.

  2. Navigate to the C:\Program Files\ibm\cognos\jupyter\dist\scripts directory, and create a new directory named tmp.
  3. Place all of the tar.gz packages that you downloaded into the tmp directory.
  4. Open the file C:\Program Files\ibm\cognos\jupyter\dist\scripts\Dockerfile_server_instance for editing.
  5. Modify the file in the following way:
    1. Under the line
      COPY additional_pip_packages.txt /home/ca_user

      add the following new line

      COPY tmp/ /tmp/

      This line instructs Docker to take your packages, and place them into the Docker container during the build.

    2. Comment out the following section:
      #‌COPY additional_conda_packages.txt .
      #‌RUN if [ -s additional_conda_packages.txt ]; then \
      #‌ conda install --yes --file additional_conda_packages.txt; \
      #‌ fi \
      #‌&& rm additional_conda_packages.txt
  6. Save the Dockerfile_server_instance file ensuring that it's saved without a file extension.
  7. Open the file C:\Program Files\ibm\cognos\jupyter\dist\scripts\additional_pip_packages.txt for editing.
  8. Modify the file in the following way:
    1. Remove the line listing the existing package name and version.
    2. Add the following new line /tmp/<package-name>.tar.gz. Ensure that the path matches the exact name of your tar.gz file.
    3. Add a new line for every package that you want to install this way.
  9. Save the additional_pip_packages.txt file.
  10. Run the Windows installation script by using the following command: C:\Program Files\ibm\cognos\jupyter\dist\scripts\windows\install.bat.