TensorRT-LLM conversion and build scripts fail after NumPy is upgraded inside a pinned container
NGC containers ship a set of extensions compiled against a specific NumPy major version. Installing anything that pulls a newer NumPy replaces the runtime those extensions were built for, and the next conversion or build script fails inside a TensorRT-LLM module that has nothing to do with the package that was installed.
Something upgraded NumPy inside the image. Pin it back to the major version the container shipped with; the extensions are already compiled for it, so nothing has to be rebuilt.
What this failure is
A binary-interface incompatibility in which compiled extensions bundled with a TensorRT-LLM container are loaded against a NumPy major version different from the one they were built for, failing inside TensorRT-LLM rather than in the package that triggered the change.
Why it happens (the mechanism)
The container is a matched set of binaries and the versions they were compiled against. Pip understands version requirements but not which compiled artefacts depend on the version it is satisfying, so an unrelated requirements file can replace a foundation that other binaries are standing on. Nothing reports a conflict because, at the metadata level, there is none.
What you'll observe
- The container is the official one and the command is from the documentation, and it still fails
- The traceback points into tensorrt_llm rather than at anything that was installed
- It worked in a fresh container and stopped after an unrelated pip install
- Reinstalling TensorRT-LLM does not help, because the incompatibility is with a dependency
Common symptoms and what they mean
| Symptom | Why it happens |
|---|---|
| A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x as it may crash | Compiled Python extensions bind to NumPy's binary interface at build time, not at import time. A major NumPy release changes that interface, so an extension built against the previous one is no longer loadable even though the Python-level API looks unchanged and pip records no conflict. |
| Traceback ending in tensorrt_llm/_common.py or tensorrt_llm/builder.py during a conversion or build step | The container's value is that its extensions, CUDA libraries and NumPy were built and pinned together. Installing a package whose metadata merely asks for a newer NumPy is enough to break that set, because pip resolves the request without knowing which binaries depend on the version it is replacing. |
| TypeError: set_weights_name(): incompatible function arguments. The following argument types are supported | The traceback misleads because the first thing to import a compiled extension is what raises. That is usually a TensorRT-LLM internal module, so the component that reports the failure is rarely the component whose installation caused it. |
| Invoked with: an INetworkDefinition, a raw array with a dtype and shape, and a weight name string | Compiled Python extensions bind to NumPy's binary interface at build time, not at import time. A major NumPy release changes that interface, so an extension built against the previous one is no longer loadable even though the Python-level API looks unchanged and pip records no conflict. |
| A pybind11 overload resolution failure where a numpy array is passed where tensorrt.Weights is expected | The container's value is that its extensions, CUDA libraries and NumPy were built and pinned together. Installing a package whose metadata merely asks for a newer NumPy is enough to break that set, because pip resolves the request without knowing which binaries depend on the version it is replacing. |
| Traceback through tensorrt_llm/parameter.py set_name into network.trt_network.set_weights_name | The traceback misleads because the first thing to import a compiled extension is what raises. That is usually a TensorRT-LLM internal module, so the component that reports the failure is rarely the component whose installation caused it. |
Which systems are affected
- NGC TensorRT-LLM and Triton containers, whose extensions are compiled against a pinned NumPy
- Model conversion scripts shipped as source in the examples directory, run against an installed wheel
- Any environment where a requirements file for a model or dataset is installed on top of the image
- Long-lived container images that accumulate packages rather than being rebuilt
How to confirm this is the problem
Apply the following checklist to a small reproduction: each box below is a positive signal that you are looking at this exact failure rather than a sibling in the same taxonomy.
- ✓Print the installed NumPy version and compare it against the version the image shipped with; a major-version difference is the whole explanation.
- ✓Read the traceback upward to the first frame that is not inside NumPy. That names the incompatible binary.
- ✓Run the identical command in a freshly started container from the same image. Success there confirms the environment was mutated rather than the command being wrong.
Example training logs (fingerprint)
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.1 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0.
File "/opt/venv-tritonserver/lib/python3.12/site-packages/tensorrt_llm/_common.py", line 224, in decorated
File "/opt/venv-tritonserver/lib/python3.12/site-packages/tensorrt_llm/builder.py", line 1267, in buildTimestamps and exact values vary across runs, but the pattern. An info-level start, an early WARN, an ERROR carrying the symptom. Is the actual fingerprint you should alert on. The Denpex platform flags this combination automatically.
Root cause, fix & prevention, signed in
Sign up free to see why this failure really happens, the exact remediation steps, and the production-grade prevention pattern. You also get 3 free full diagnoses for your own training logs.
Sign up free. Unlock the full analysisNo credit card · 3 free diagnoses · Instant access
Why the recommended fix works
Restoring the original major version returns the binary interface the extensions expect, so they load again with no recompilation. It is a faster and more reliable fix than upgrading the extensions, because the container already contains a consistent set and the only thing that changed was one member of it.
Code examples
// Typical pattern:
import torch.optim as optim
optimizer = optim.AdamW(model.parameters(), lr=3e-4)
scheduler = optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=num_training_steps)
for step in range(num_training_steps):
optimizer.zero_grad()
loss = model(batch)
loss.backward()
optimizer.step()
scheduler.step()Adapt the snippet to your framework. The same pattern holds for PyTorch Lightning, Hugging Face Trainer, DeepSpeed, Megatron-LM, and vLLM training wrappers. Where the wrapper exposes a config flag (for examplelr_scheduler_type in Trainer), prefer the flag over the imperative API to keep the schedule declarative and reproducible.
Best practices by model family
| Model / Stack | Recommendation | Notes |
|---|---|---|
| Container worked, then stopped | Pin NumPy back to the image's major version | The extensions are already built for it. |
| Installing model requirements | Constrain pip against the image's existing versions | Stops a transitive requirement replacing a pinned binary dependency. |
| Genuinely need newer NumPy | Rebuild the image, do not mutate the container | Extensions must be compiled against the version that will be present. |
| Assembling the stack by hand | Use the official image for the release | The matched pinning is the thing the image provides. |
With the fix vs without the fix
| Dimension | With the fix | Without the fix |
|---|---|---|
| What pip checks | Declared version requirements | Assumed to include binary compatibility |
| What the traceback names | The first module to import a compiled extension | Read as the component at fault |
| Correct response | Restore the pinned version | Reinstall TensorRT-LLM |
Real engineering notes
“The traceback is actively misleading and costs the most time here. It points into TensorRT-LLM, so the instinct is to reinstall TensorRT-LLM or blame the conversion script, when the offending change was a pip install performed minutes earlier for something unrelated. If a container worked and then stopped without the command changing, reconstruct what was installed into it before reading the traceback at all.”
Visual fingerprint
image as shipped extensions compiled against NumPy 1.x + NumPy 1.x -> works pip install <thing> requirement asks for NumPy >= 2 -> NumPy 2.x installed next build extensions compiled against NumPy 1.x + NumPy 2.x -> fails pip reports no conflict: the requirement was satisfiable
Related failures to investigate next
Root cause, fix & prevention
Frequently asked questions
Twelve targeted questions that engineers and on-call staff most commonly ask about this failure.
Why does the traceback point at TensorRT-LLM?
Pip did not warn me about a conflict.
Should I reinstall TensorRT-LLM?
I actually need the newer NumPy.
Don't just read the fix, diagnose your run
The encyclopedia tells you what went wrong. Denpex tells you what went wrong in YOUR training run. With your logs, your config, and your stack.