PyTorch GPU build on Jetson AGX Orin (JetPack 6.1 / CUDA 12.6) failing due to NumPy ABI mismatch

Hello, I’m currently trying to enable GPU acceleration for PyTorch on my Jetson AGX Orin.

System Information

Item Version
Device Jetson AGX Orin Developer Kit (64GB RAM)
JetPack / L4T 6.1 (L4T 36.4.0)
CUDA 12.6.68
cuDNN 9.3.0
TensorRT 10.3.0
Python 3.10.12
Ubuntu 22.04
OpenCV with CUDA Yes (working fine)
jtop confirms GPU features Yes

What I attempted

I installed PyTorch for JetPack 6 manually from the Jetson-AI-Lab pip repository:

https://pypi.jetson-ai-lab.io/jp6/cu126

I downloaded:

torch-2.8.0-cp310-cp310-linux_aarch64.whl
torchvision-0.20.0-cp310-cp310-linux_aarch64.whl

Then installed manually using:

pip3 install torch*.whl
pip3 install torchvision*.whl

The installation was successful and PyTorch loads correctly.
torch.cuda.is_available() returns True and the GPU name is detected.

Problem

When running any YOLO / Ultralytics model or even importing PyTorch functional ops, I receive this error:

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x.
NumPy 2.2.6 is installed. To support both 1.x and 2.x versions of NumPy, modules
must be compiled with NumPy ≥ 2.0.

UserWarning: Failed to initialize NumPy:
RuntimeError: NumPy is not available

This causes inference to crash.

My Understanding

It appears that:

  • The PyTorch wheel was built against NumPy 1.x, but

  • JetPack 6 images come with NumPy 2.x, causing ABI mismatch. Any guidance or official compatibility matrix would be extremely helpful.
    Thank you!

Hi,

Please try below commands to check whether issue exists

pip uninstall numpy
pip install "numpy<2"

Thanks

Hi, thanks for the response.

The issue I’m facing is that when I downgrade NumPy to <2 so that PyTorch works, my OpenCV CUDA build stops working.

The reason seems to be:

  • PyTorch wheels for JetPack 6.1 require NumPy 1.x.

  • OpenCV with CUDA on JetPack was compiled against NumPy 2.x.

  • So when I downgrade NumPy, the OpenCV CUDA bindings break.

  • If I keep NumPy 2.x, PyTorch fails instead.

So effectively PyTorch and OpenCV CUDA end up requiring different NumPy ABI versions under JetPack 6.1.

My question:
Is there an official way to install both PyTorch and OpenCV CUDA that are built against the same NumPy version, so that both can work together?

Hi,

What error log do you get if numpy<1.0?
We have another method for building PyTorch from source. Please refer to the topics below.

Thanks

Hi @blueberrie,

Generally, prebuilt packages expect a specific version of each dependency, as you saw even if it installs doesn’t mean it will be compatible. Since you have custom versions, it would be better to build PyTorch from source on your Jetson board. To do so follow the instructions described in this repo for Linux only. It recommends using a Conda virtual environment and while not necessary it would be better to do so. Be sure to specify the correct CUDA version (12.6) while executing the install_magma_conda.sh script.

Regards,
Daniel R.
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com
Website: www.ridgerun.com

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.