Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - libs - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
17.20
Publication Date
November 2022
Content Type
Programming Reference
Publication ID
B700-4500-112K
ft:locale
en-US
ft:lastEdition
2024-02-21
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_1720
Product Category
Teradata Vantage
teradataml.scriptmgmt.UserEnv.UserEnv.libs
DESCRIPTION:
    A class property that returns list of libraries installed in the remote user environment.
 
PARAMETERS:
    None
 
RETURNS:
    Pandas DataFrame containing libraries and their versions.
 
RAISES:
    TeradataMlException
 
EXAMPLES:
    # Example 1: libs property for Python environment.
    # Create a remote Python user environment.
    >>> env = create_env('test_env', 'python_3.7.9', 'Test environment')
    User environment test_env created.
 
    # View existing libraries installed.
    >>> env.libs
             name version
    0         pip  20.1.1
    1  setuptools  47.1.0
 
    # Install additional Python libraries.
    >>> env.install_lib(['numpy','nltk>=3.3'])
    Request to install libraries initiated successfully in the remote user environment test_env. Check the status using status() with the claim id '1e23d244-3c88-401f-a432-277d72dc6835'.
    '1e23d244-3c88-401f-a432-277d72dc6835'
 
    # List libraries installed.
    >>> env.libs
             name version
    0        nltk   3.4.5
    1       numpy  1.21.6
    2         pip  20.1.1
    3  setuptools  47.1.0
    4         six  1.16.0
 
    # Example 2: libs property for R environment.
    # Create a remote R user environment.
    >>> r_env = create_env('test_r_env', 'r_4.1', 'Test R environment')
    User environment 'test_r_env' created.
 
    # List installed libraries in environment.
    >>> r_env.libs
              name  version
    0   KernSmooth  2.23-20
    1         MASS   7.3-55
    2       Matrix    1.4-0
    3         base    4.1.3
    4         boot   1.3-28
    ..         ...      ...
    26    survival   3.2-13
    27       tcltk    4.1.3
    28       tools    4.1.3
    29       utils    4.1.3
 
    # Install additional R libraries.
    >>> r_env.install_lib(['dplyr','testthat==3.0.4'])
                                    Claim Id                File/Libs   Method Name       Stage              Timestamp  Additional Details
    0   3823217b-89ee-423c-9ed1-f72a6b6d0511    dplyr, testthat=3.0.4   install_lib      Started  2023-08-31T07:14:57Z
    1   3823217b-89ee-423c-9ed1-f72a6b6d0511    dplyr, testthat=3.0.4   install_lib     Finished  2023-08-31T07:20:35Z
 
    # List installed libraries in environment.
    >>> r_env.libs
              name  version
    0   KernSmooth  2.23-20
    1         MASS   7.3-55
    2       Matrix    1.4-0
    3         base    4.1.3
    ..         ...      ...
    9        dplyr    1.1.2
    ..         ...      ...
    58    testthat    3.0.4
    ..         ...      ...
    61       vctrs    0.6.3
    62       waldo    0.5.1
    63       withr    2.5.0
    [64 rows x 2 columns]