-
-
Notifications
You must be signed in to change notification settings - Fork 655
Open
Description
Python bindings fail due to conflicting NumPy versions
I built jetson-inference Python bindings on Jetson (Ubuntu 22.04, Python 3.10) and ran into runtime errors when importing:
RuntimeError: FATAL: module compiled as little endian, but detected different endianness at runtime
SystemError: initialization of jetson_utils_python raised unreported exception
Root cause
There were multiple conflicting NumPy installations on my system:
- System NumPy:
/usr/lib/python3/dist-packages/numpy(v1.21.5) - User-local pip:
~/.local/lib/python3.10/site-packages/numpy(newer versions) - Stray Jetson bindings:
/usr/local/lib/python3.10/dist-packages/jetson_utils_python.so
These conflicts caused a C-API mismatch, resulting in the Python bindings failing to load.
Steps that resolved the issue
# 1. Remove user-local NumPy
rm -rf ~/.local/lib/python3.10/site-packages/numpy*
# 2. Remove stray Jetson bindings
sudo rm -f /usr/local/lib/python3.10/dist-packages/jetson_*.so
# 3. Rebuild Python bindings
cd ~/dev/jetson-inference/build
cmake ..
make -j$(nproc)
sudo make install
# 4. Verify
python3 -c "import numpy; import jetson.utils; import jetson.inference; print('✅ Jetson Inference loaded successfully')"
After this, the Python bindings loaded correctly without runtime errors.
#Suggested improvements for documentation
Warn users about conflicting NumPy versions before building Python bindings.
Include a post-build verification step for Python path and NumPy version.
Provide a cleanup script for old bindings and stray NumPy installs.
These steps would save future users significant debugging time.
#Environment used:
Jetson device: Jetson Orin Nano / Xavier NX (aarch64)
Ubuntu: 22.04 LTS
Python: 3.10.12\
CUDA: 12.6
OpenCV: 4.8.0
NumPy: 1.21.5 (system)Metadata
Metadata
Assignees
Labels
No labels