tdfs4ds.utils.teradata_packages¶
tdfs4ds.utils.teradata_packages
¶
teradataml and teradatagenai installed as a pair that does not import together.
teradatagenai imports private teradataml names, so upgrading one package without
the other can break import teradatagenai itself. Seen live: teradatagenai
20.0.0.9 imports teradataml.context.context._get_user, which teradataml
20.0.0.12 no longer has; teradatagenai 20.0.0.10 imports the renamed function and
requires teradataml 20.0.0.12 or later.
tdfs4ds does not pin the pair in setup.py: a customer may have to stay on a
given teradataml, and at install time pip already picks a teradatagenai that
matches it. The break comes later, when one package is upgraded alone. So it is
reported where it shows: check_configuration and every place tdfs4ds imports
teradatagenai (Teradata Vector Store, in-database embedding), with both installed
versions and the two ways out. No import of teradataml or teradatagenai here.
MISMATCH_HINT
module-attribute
¶
MISMATCH_HINT = 'teradataml and teradatagenai are installed but are not a matching pair: this teradatagenai imports a teradataml internal that this teradataml no longer has (seen with teradataml 20.0.0.12 + teradatagenai 20.0.0.9). Nothing is missing. Two ways out, take the one your environment allows: (1) keep teradataml and upgrade teradatagenai, `%pip install -U teradatagenai` (teradatagenai 20.0.0.10 works with teradataml 20.0.0.12 and later); or (2) keep teradatagenai and install the teradataml it imports with, for example `%pip install "teradataml==20.0.0.11"` with teradatagenai 20.0.0.9. If a package above is marked \'user site ~/.local\', it shadows the environment\'s own copy: remove it there first (`%pip uninstall -y teradataml teradatagenai langchain-teradata teradatasqlalchemy` once: pip removes the copy found first, the user site one), so the environment\'s own pair is used. Use %pip, not !pip, so the packages go to the running interpreter, then restart the kernel. tdfs4ds.check_configuration() shows the installed versions.'
IMAGE_HINT
module-attribute
¶
IMAGE_HINT = 'In a Docker image: set the build arguments TERADATAML_VERSION and TERADATAGENAI_VERSION to a matching pair (in .env next to docker-compose.yml, or --build-arg), for example TERADATAGENAI_VERSION=20.0.0.10 with teradataml 20.0.0.12 or later, or TERADATAML_VERSION=20.0.0.11 with TERADATAGENAI_VERSION=20.0.0.9; leave both empty to let pip choose. Then rebuild: docker compose build --no-cache.'
CHECKED_MODULES
module-attribute
¶
is_mismatch
¶
Is this the cannot import name ... from 'teradataml....' failure?
package_versions
¶
Installed versions of the Teradata client packages and where each sits.
Read from the distribution metadata, so it works when the import itself
fails. A copy in the user site (~/.local) is flagged: it comes first on
sys.path and shadows the environment's own copy, which is how a
%pip install --user in one kernel breaks every other environment.
Never raises.
check_pair
¶
Do the installed teradataml and teradatagenai import together?
Returns (status, message): 'ok'; 'mismatch' (the pair does not
import together); 'absent' (a package is not installed, the Teradata Vector
Store and in-database embedding are then unavailable, Chroma still works);
'other' (another import error, its whole text). Imports the modules, so
run it in the interpreter that will use them. Never raises.
main
¶
python -m tdfs4ds.utils.teradata_packages [--image].
Exit 1 only for a mismatch (the image build stops there instead of producing an image whose Vector Store fails at first use); a package that is absent or fails otherwise is reported and exits 0, since the app still runs with Chroma.
mismatch_error
¶
A RuntimeError explaining the mismatch, or None for any other error.
what names the feature that needed teradatagenai. The original message is
kept in the text (check_configuration matches on it) and exc is the
__cause__.