- Assume you want to create a new Python user environment equipped with Python 3.10.
demo_env = create_env(env_name='py_nltk_env', base_env='python_3.10', desc='py test env', conda_env=True)
User environment 'py_nltk_env' created.
- Verify the new environment has been created.
list_user_envs()
env_name env_description base_env_name language conda 0 py_nltk_env py test env python_3.10 Python True
- Use the user environment handler to manage it and install the libraries needed for the analysis.
- View the existing libraries in the user environment.
demo_env.libs
name version 0 _libgcc_mutex 0.1 1 _openmp_mutex 5.1 2 bzip2 1.0.8 3 ca-certificates 2023.12.12 4 ld_impl_linux-64 2.38 5 libffi 3.4.4 6 libgcc-ng 11.2.0 7 libgomp 11.2.0 8 libstdcxx-ng 11.2.0 9 libuuid 1.41.5 10 ncurses 6.4 11 openssl 3.0.13 12 pip 23.3.1 13 python 3.10.13 14 readline 8.2 15 setuptools 68.2.2 16 sqlite 3.41.2 17 tk 8.6.12 18 tzdata 2023d 19 wheel 0.41.2 20 xz 5.4.5 21 zlib 1.2.13
- Install required Python libraries from the requirement file which will install any dependencies in the user environment. The libraries must be specified in the install_lib() function.The requirement file contains:
nltk==3.0.0
claim_id = demo_env.install_lib(libs_file_path=os.path.join(path_to_reqsfiles, 'reqs_nltk.txt'), asynchronous=False)
The default value of the asynchronous parameter is False, which means you need to wait until installation is complete to proceed with the next statement. However, by specifying asynchronous=True, teradataml enables you to continue executing statements while installation takes place asynchronously in the background. Avoid using the libraries you request before installation is complete. - Check the status.
demo_env.status(claim_id)
- Verify the desired Python libraries have been installed correctly.
demo_env.libs
- View the existing libraries in the user environment.