Class PythonEnvironmentManagerUtils

java.lang.Object
org.apache.flink.python.util.PythonEnvironmentManagerUtils

@Internal public class PythonEnvironmentManagerUtils extends Object
Utils used to prepare the python environment.
  • Field Details

  • Constructor Details

    • PythonEnvironmentManagerUtils

      public PythonEnvironmentManagerUtils()
  • Method Details

    • pipInstallRequirements

      public static void pipInstallRequirements(String requirementsFilePath, @Nullable String requirementsCacheDir, String requirementsInstallDir, String pythonExecutable, Map<String,String> environmentVariables) throws IOException
      Installs the 3rd party libraries listed in the user-provided requirements file. An optional requirements cached directory can be provided to support offline installation. In order not to populate the public environment, the libraries will be installed to the specified directory, and added to the PYTHONPATH of the UDF workers.
      Parameters:
      requirementsFilePath - The path of the requirements file.
      requirementsCacheDir - The path of the requirements cached directory.
      requirementsInstallDir - The target directory of the installation.
      pythonExecutable - The python interpreter used to launch the pip program.
      environmentVariables - The environment variables used to launch the pip program.
      Throws:
      IOException
    • getPythonUdfRunnerScript

      public static String getPythonUdfRunnerScript(String pythonExecutable, Map<String,String> environmentVariables) throws IOException
      Throws:
      IOException
    • getPythonVersion

      public static String getPythonVersion(String pythonExecutable) throws IOException
      Throws:
      IOException