{"id":22448,"library":"tensorrt-cu12-libs","title":"TensorRT Libraries (CUDA 12.x)","description":"NVIDIA TensorRT libraries for CUDA 12.x, providing core runtime and plugin libraries for high-performance deep learning inference. Current version 10.16.1.11. Released on PyPI as a separate wheel to isolate CUDA 12 dependencies; updates follow TensorRT releases (approximately quarterly).","status":"active","version":"10.16.1.11","language":"python","source_language":"en","source_url":"https://github.com/nvidia/tensorrt","tags":["tensorrt","nvidia","inference","deep-learning","cuda12"],"install":[{"cmd":"pip install tensorrt-cu12-libs==10.16.1.11","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Python bindings that wrap the libraries; both must match version exactly.","package":"tensorrt-cu12-bindings","optional":false},{"reason":"Required for CUDA context management and memory transfers in Python workflows.","package":"cuda-python","optional":true}],"imports":[{"note":"Importing all with * pollutes namespace; use alias trt.","wrong":"from tensorrt import *","symbol":"tensorrt","correct":"import tensorrt as trt"}],"quickstart":{"code":"import tensorrt as trt\nimport os\n\n# Verify installation\nprint(f\"TensorRT version: {trt.__version__}\")\n\n# Create a logger\nlogger = trt.Logger(trt.Logger.WARNING)\n\n# Build a simple identity network\nbuilder = trt.Builder(logger)\nnetwork = builder.create_network(1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH))\n\n# Add an input tensor\ninput_tensor = network.add_input(name=\"input\", dtype=trt.float32, shape=(1, 3, 224, 224))\n\n# Add an identity layer (pass-through)\nidentity = network.add_identity(input_tensor)\n\n# Mark output\nnetwork.mark_output(identity.get_output(0))\n\n# Build engine\nconfig = builder.create_builder_config()\nconfig.set_memory_pool_limit(trt.MemoryPoolType.WORKSPACE, 1 << 30)  # 1 GB\nengine_bytes = builder.build_serialized_network(network, config)\n\nif engine_bytes:\n    print(\"Engine built successfully\")\nelse:\n    print(\"Engine build failed\")","lang":"python","description":"Verifies TensorRT installation and creates a trivial identity engine."},"warnings":[{"fix":"Check CUDA version via `nvcc --version` and install matching -cuXX- variant.","message":"The tensorrt-cu12-libs package only supports CUDA 12.x. On CUDA 11 systems, use tensorrt-cu11-libs instead. Mixing CUDA versions causes cryptic runtime errors.","severity":"breaking","affected_versions":">=10.0"},{"fix":"Install exact same version for all components, e.g., pip install tensorrt-cu12-libs==10.16.1.11 tensorrt-cu12-bindings==10.16.1.11 tensorrt==10.16.1.11","message":"All tensorrt-* packages (libs, bindings, python) must be the same version. Version mismatch leads to import errors or segmentation faults.","severity":"breaking","affected_versions":">=10.0"},{"fix":"Also install tensorrt (full) or tensorrt-cu12-bindings (Python bindings only).","message":"The tensorrt-cu12-libs wheel does not include the Python bindings; you must install tensorrt or tensorrt-cu12-bindings separately.","severity":"gotcha","affected_versions":">=10.0"},{"fix":"Plan migration to CUDA 13.2 to use the default tensorrt package.","message":"TensorRT 10.16 defaults to CUDA 13.2; the cu12 variant is available for legacy CUDA 12 compatibility but may be dropped in future releases.","severity":"deprecated","affected_versions":">=10.16"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install tensorrt (full) or tensorrt-cu12-bindings: pip install tensorrt-cu12-libs==10.16.1.11 tensorrt-cu12-bindings==10.16.1.11","cause":"Python bindings not installed; only the libs package is installed.","error":"ModuleNotFoundError: No module named 'tensorrt'"},{"fix":"Add TensorRT lib directory to LD_LIBRARY_PATH, e.g., export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/tensorrt/lib (or the site-packages tensorrt directory).","cause":"LD_LIBRARY_PATH not set or missing CUDA libraries.","error":"ImportError: libnvinfer.so.10: cannot open shared object file: No such file or directory"},{"fix":"Rebuild engine with the same TensorRT version as the runtime, or use a compatible version.","cause":"Engine was built with a different TensorRT version than the runtime.","error":"tensorrt.RuntimeError: [runtime.cpp::validateEngine::625] Error Code 1: Serialization (Serialized engine version X does not match TensorRT version Y)"},{"fix":"Rebuild the engine with the exact TensorRT version in use.","cause":"Attempting to use an engine built with a different TensorRT major version.","error":"AssertionError: (shape) vs (expected shape) - TensorRT: The engine plan file is not compatible with this version of TensorRT."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}