Set Up and Manage User Environment | Examples with DataFrame.apply Method| Teradata Open Analytics Framework - Set Up and Manage the User Environment - Teradata VantageCloud Lake

Lake - Analyze Your Data with ClearScape Analytics™

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2026-02-20
dita:mapPath
tcl1683670667798.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
tcl1683670667798
  1. Explore the base environments offered on the target system.
    list_base_envs()

    Out:

            base_name        language     version
    0        python_3.8        Python             3.8.18
    1        python_3.9        Python             3.9.18
    2        python_3.10       Python             3.10.13
  2. Create a new Python user environment from available base environment equipped with Python 3.10.13.
    testenv = create_env(env_name = 'apply_method_test_env',
                         base_env = 'python_3.10',
                         desc = 'A test env for the apply method')
  3. Verify the new environment has been created.
    list_user_envs()

    Out:

             env_name                env_description                     base_env_name   language
    0      apply_method_test_env    A test env for the apply method        python_3.10     Python
  4. Utilize the user environment handler to manage and install the libraries needed for the analysis.
    1. View the existing libraries in the user environment.
      demo_env.libs

      Out:

              name              version
      0        pip               23.0.1
      1        setuptools        65.5.0
    2. Install required Python libraries dill and pandas in the user environment to use the apply method.
      The dill version installed in the remote user environment must match the version of the one installed on the client machine.
      claim_id = testenv.install_lib(['pandas','dill'])

      Out:

      Libraries installed successfully in the remote user environment testenv.
    3. Verify the desired Python libraries have been installed correctly.
      testenv.libs

      Out:

               name               version
      0        dill               0.3.8
      1        numpy              1.26.4
      2        pandas             2.2.1
      3        pip                23.0.1
      4        python-dateutil    2.9.0
      5        pytz               2024.1
      6        setuptools         65.5.0
      7        six                1.16.0
      8        tzdata             2024.1