Search code examples
pythonnvidia-jetson

Nvidia Jetson Xavier Hello AI World, error when running example


I have recently purchased a Nvidia Jetson AGX Xavier. I flashed the system and installed the tools using the SDKManager and all seemed ok.

I wanted to run the Hello AI World tutorial to familiarize myself with the system. When running the python example:

./imagenet-console.py --network=googlenet orange_0.jpg output_0.jpg 

I received the error:

jetson.inference.__init__.py
Traceback (most recent call last):
  File "./imagenet-console.py", line 24, in <module>
    import jetson.inference
  File "/usr/lib/python2.7/dist-packages/jetson/inference/__init__.py", line 4, in <module>
    from jetson_inference_python import *
ImportError: libjetson-utils.so: cannot open shared object file: No such file or directory

I reflashed the system and tried again and got the same error. After some effort I found a solution which I have posted below. I have lodged this Q&A to assist other who will no doubt have the same problem.


Solution

  • First, I note that you need an editor and the Jetson Xavier doesn't seem to come with nano editor installed so I installed this using

    sudo apt-get install nano
    

    The solution I found here:

    error-while-loading-shared-libraries-cannot-open-shared-object-file

    In particular, I quote Bob Plankers' preferred solution:

    ask the dynamic linker to check /usr/local/lib

    Edit the file /etc/ld.so.conf and add “/usr/local/lib” on its own line at the bottom[3].

    DO NOT REMOVE THINGS FROM THIS FILE. When you’re done it might look something like:

    $ cat /etc/ld.so.conf
    include ld.so.conf.d/*.conf
    /usr/local/lib
    

    or it might look completely different, with the exception of the last line.

    *****IMPORTANT*** Run ldconfig to tell it to update the cache:**

    $ sudo ldconfig
    

    You can check your work with:

    $ ldconfig -p | grep local