Running tensorRT sample on nano

Hello,

Good morning.

Trying to run the tensorRT sample under the following directory on jetson nano
I ran the python -m pip install -r requirements.txt command and got an error.
How can I run the sample?

/usr/src/tensorrt/samples/python

============= error =====================
python2 -m pip install -r requirements.txt
Collecting numpy>=1.15.1 (from -r requirements.txt (line 1))
Collecting protobuf>=3.11.3 (from -r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/81/d4/a8a31a326ee60e295e5d7477d93d8f6ceee98246c1a7381afc817a91d893/protobuf-3.14.0-py2.py3-none-any.whl
Collecting onnx==1.6.0 (from -r requirements.txt (line 3))
Using cached https://files.pythonhosted.org/packages/81/a9/a14c3bc32908c37b46b19a89eb6185b0c90fd9c03ef12379d51940b8fc71/onnx-1.6.0.tar.gz
Collecting pycuda>=2017.1.1 (from -r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/5e/3f/5658c38579b41866ba21ee1b5020b8225cec86fe717e4b1c5c972de0a33c/pycuda-2019.1.2.tar.gz
Collecting Pillow==6.2.2 (from -r requirements.txt (line 5))
Collecting wget>=3.2 (from -r requirements.txt (line 6))
Collecting six>=1.9 (from protobuf>=3.11.3->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting typing-extensions>=3.6.2.1 (from onnx==1.6.0->-r requirements.txt (line 3))
Using cached https://files.pythonhosted.org/packages/be/e1/8fe3f8a8aa3380f2a92b0075406c49f96fcc2b256f5c92d09571d2ab7847/typing_extensions-3.7.4.3-py2-none-any.whl
Collecting typing>=3.6.4 (from onnx==1.6.0->-r requirements.txt (line 3))
Using cached https://files.pythonhosted.org/packages/3b/c0/e44213fcb799eac02881e2485724ba5b0914600bc9df6ed922e364fdc059/typing-3.7.4.3-py2-none-any.whl
Collecting appdirs>=1.4.0 (from pycuda>=2017.1.1->-r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl
Collecting decorator>=3.2.0 (from pycuda>=2017.1.1->-r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl
Collecting mako (from pycuda>=2017.1.1->-r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/a6/37/0e706200d22172eb8fa17d68a7ae22dec7631a0a92266634fb518a88a5b2/Mako-1.1.3-py2.py3-none-any.whl
Collecting pytools>=2011.2 (from pycuda>=2017.1.1->-r requirements.txt (line 4))
Collecting MarkupSafe>=0.9.2 (from mako->pycuda>=2017.1.1->-r requirements.txt (line 4))
Building wheels for collected packages: onnx, pycuda
Running setup.py bdist_wheel for onnx … error
Complete output from command /usr/bin/python2 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-XPIwe5/onnx/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” bdist_wheel -d /tmp/tmp36mg1upip-wheel- --python-tag cp27:
fatal: not a git repository (or any of the parent directories): .git
running bdist_wheel
running build
running build_py
running create_version
running cmake_build
– The C compiler identification is GNU 7.5.0
– The CXX compiler identification is GNU 7.5.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
Generated: /tmp/pip-build-XPIwe5/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
CMake Error at CMakeLists.txt:248 (message):
Protobuf compiler not found
Call Stack (most recent call first):
CMakeLists.txt:279 (relative_protobuf_generate_cpp)

– Configuring incomplete, errors occurred!
See also “/tmp/pip-build-XPIwe5/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log”.
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-build-XPIwe5/onnx/setup.py”, line 334, in
‘backend-test-tools = onnx.backend.test.cmd_tools:main’,
File “/usr/lib/python2.7/dist-packages/setuptools/init.py”, line 129, in setup
return distutils.core.setup(**attrs)
File “/usr/lib/python2.7/distutils/core.py”, line 151, in setup
dist.run_commands()
File “/usr/lib/python2.7/distutils/dist.py”, line 953, in run_commands
self.run_command(cmd)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py”, line 204, in run
self.run_command(‘build’)
File “/usr/lib/python2.7/distutils/cmd.py”, line 326, in run_command
self.distribution.run_command(command)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/usr/lib/python2.7/distutils/command/build.py”, line 128, in run
self.run_command(cmd_name)
File “/usr/lib/python2.7/distutils/cmd.py”, line 326, in run_command
self.distribution.run_command(command)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/tmp/pip-build-XPIwe5/onnx/setup.py”, line 209, in run
self.run_command(‘cmake_build’)
File “/usr/lib/python2.7/distutils/cmd.py”, line 326, in run_command
self.distribution.run_command(command)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/tmp/pip-build-XPIwe5/onnx/setup.py”, line 195, in run
subprocess.check_call(cmake_args)
File “/usr/lib/python2.7/subprocess.py”, line 190, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[u’/usr/bin/cmake’, u’-DPYTHON_INCLUDE_DIR=/usr/include/python2.7’, u’-DPYTHON_EXECUTABLE=/usr/bin/python2’, u’-DBUILD_ONNX_PYTHON=ON’, u’-DCMAKE_EXPORT_COMPILE_COMMANDS=ON’, u’-DONNX_NAMESPACE=onnx’, u’-DPY_EXT_SUFFIX=’, u’-DCMAKE_BUILD_TYPE=Release’, u’-DONNX_ML=1’, ‘/tmp/pip-build-XPIwe5/onnx’]’ returned non-zero exit status 1


Failed building wheel for onnx
Running setup.py clean for onnx
Running setup.py bdist_wheel for pycuda … error
Complete output from command /usr/bin/python2 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-XPIwe5/pycuda/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” bdist_wheel -d /tmp/tmpFuU3G1pip-wheel- --python-tag cp27:


*** WARNING: nvcc not in path.
*** May need to set CUDA_INC_DIR for installation to succeed.



*** I have detected that you have not run configure.py.


*** Additionally, no global config files were found.
*** I will go ahead with the default configuration.
*** In all likelihood, this will not work out.


*** See README_SETUP.txt for more information.


*** If the build does fail, just re-run configure.py with the
*** correct arguments, and then retry. Good luck!


*** HIT Ctrl-C NOW IF THIS IS NOT WHAT YOU WANT


Continuing in 1 seconds…
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: ‘test_requires’
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-2.7
creating build/lib.linux-aarch64-2.7/pycuda
copying pycuda/_mymako.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/_cluda.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/characterize.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/reduction.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/compiler.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/tools.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/curandom.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/gpuarray.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/init.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/autoinit.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/scan.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/elementwise.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/debug.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/cumath.py -> build/lib.linux-aarch64-2.7/pycuda
copying pycuda/driver.py -> build/lib.linux-aarch64-2.7/pycuda
creating build/lib.linux-aarch64-2.7/pycuda/gl
copying pycuda/gl/init.py -> build/lib.linux-aarch64-2.7/pycuda/gl
copying pycuda/gl/autoinit.py -> build/lib.linux-aarch64-2.7/pycuda/gl
creating build/lib.linux-aarch64-2.7/pycuda/sparse
copying pycuda/sparse/operator.py -> build/lib.linux-aarch64-2.7/pycuda/sparse
copying pycuda/sparse/inner.py -> build/lib.linux-aarch64-2.7/pycuda/sparse
copying pycuda/sparse/cg.py -> build/lib.linux-aarch64-2.7/pycuda/sparse
copying pycuda/sparse/packeted.py -> build/lib.linux-aarch64-2.7/pycuda/sparse
copying pycuda/sparse/init.py -> build/lib.linux-aarch64-2.7/pycuda/sparse
copying pycuda/sparse/pkt_build.py -> build/lib.linux-aarch64-2.7/pycuda/sparse
copying pycuda/sparse/coordinate.py -> build/lib.linux-aarch64-2.7/pycuda/sparse
creating build/lib.linux-aarch64-2.7/pycuda/compyte
copying pycuda/compyte/init.py -> build/lib.linux-aarch64-2.7/pycuda/compyte
copying pycuda/compyte/array.py -> build/lib.linux-aarch64-2.7/pycuda/compyte
copying pycuda/compyte/dtypes.py -> build/lib.linux-aarch64-2.7/pycuda/compyte
running egg_info
writing requirements to pycuda.egg-info/requires.txt
writing pycuda.egg-info/PKG-INFO
writing top-level names to pycuda.egg-info/top_level.txt
writing dependency_links to pycuda.egg-info/dependency_links.txt
reading manifest file ‘pycuda.egg-info/SOURCES.txt’
reading manifest template ‘MANIFEST.in’
warning: no files found matching ‘doc/source/_static/.css’
warning: no files found matching 'doc/source/_templates/
.html’
warning: no files found matching ‘.cpp’ under directory ‘bpl-subset/bpl_subset/boost’
warning: no files found matching '
.html’ under directory ‘bpl-subset/bpl_subset/boost’
warning: no files found matching ‘.inl’ under directory ‘bpl-subset/bpl_subset/boost’
warning: no files found matching '
.txt’ under directory ‘bpl-subset/bpl_subset/boost’
warning: no files found matching ‘.h’ under directory ‘bpl-subset/bpl_subset/libs’
warning: no files found matching '
.ipp’ under directory ‘bpl-subset/bpl_subset/libs’
warning: no files found matching ‘*.pl’ under directory ‘bpl-subset/bpl_subset/libs’
writing manifest file ‘pycuda.egg-info/SOURCES.txt’
creating build/lib.linux-aarch64-2.7/pycuda/cuda
copying pycuda/cuda/pycuda-complex-impl.hpp -> build/lib.linux-aarch64-2.7/pycuda/cuda
copying pycuda/cuda/pycuda-complex.hpp -> build/lib.linux-aarch64-2.7/pycuda/cuda
copying pycuda/cuda/pycuda-helpers.hpp -> build/lib.linux-aarch64-2.7/pycuda/cuda
copying pycuda/sparse/pkt_build_cython.pyx -> build/lib.linux-aarch64-2.7/pycuda/sparse
running build_ext
building ‘_driver’ extension
creating build/temp.linux-aarch64-2.7
creating build/temp.linux-aarch64-2.7/src
creating build/temp.linux-aarch64-2.7/src/cpp
creating build/temp.linux-aarch64-2.7/src/wrapper
creating build/temp.linux-aarch64-2.7/bpl-subset
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/python
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/python/src
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/python/src/object
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/python/src/converter
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/smart_ptr
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/smart_ptr/src
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/system
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/system/src
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/thread
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/thread/src
creating build/temp.linux-aarch64-2.7/bpl-subset/bpl_subset/libs/thread/src/pthread
aarch64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PGdld2/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DBOOST_PYTHON_SOURCE=1 -DHAVE_CURAND=1 -DPYGPU_PACKAGE=pycuda -DBOOST_THREAD_DONT_USE_CHRONO=1 -DPYGPU_PYCUDA=1 -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION=1 -DBOOST_THREAD_BUILD_DLL=1 -Dboost=pycudaboost -DBOOST_ALL_NO_LIB=1 -Isrc/cpp -Ibpl-subset/bpl_subset -I/home/jetson7/.local/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c src/cpp/cuda.cpp -o build/temp.linux-aarch64-2.7/src/cpp/cuda.o
In file included from src/cpp/cuda.cpp:4:0:
src/cpp/cuda.hpp:14:10: fatal error: cuda.h: No such file or directory
#include <cuda.h>
^~~~~~~~
compilation terminated.
error: command ‘aarch64-linux-gnu-gcc’ failed with exit status 1


Failed building wheel for pycuda
Running setup.py clean for pycuda
Failed to build onnx pycuda
Installing collected packages: numpy, six, protobuf, typing, typing-extensions, onnx, appdirs, decorator, MarkupSafe, mako, pytools, pycuda, Pillow, wget
Running setup.py install for onnx … error
Complete output from command /usr/bin/python2 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-XPIwe5/onnx/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-ls4trv-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
fatal: not a git repository (or any of the parent directories): .git
running install
running build
running build_py
running create_version
running cmake_build
Generated: /tmp/pip-build-XPIwe5/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto
CMake Error at CMakeLists.txt:248 (message):
Protobuf compiler not found
Call Stack (most recent call first):
CMakeLists.txt:279 (relative_protobuf_generate_cpp)

-- Configuring incomplete, errors occurred!
See also "/tmp/pip-build-XPIwe5/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-XPIwe5/onnx/setup.py", line 334, in <module>
    'backend-test-tools = onnx.backend.test.cmd_tools:main',
  File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
    self.run_command('build')
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
    self.run_command(cmd_name)
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/tmp/pip-build-XPIwe5/onnx/setup.py", line 209, in run
    self.run_command('cmake_build')
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/tmp/pip-build-XPIwe5/onnx/setup.py", line 195, in run
    subprocess.check_call(cmake_args)
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[u'/usr/bin/cmake', u'-DPYTHON_INCLUDE_DIR=/usr/include/python2.7', u'-DPYTHON_EXECUTABLE=/usr/bin/python2', u'-DBUILD_ONNX_PYTHON=ON', u'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', u'-DONNX_NAMESPACE=onnx', u'-DPY_EXT_SUFFIX=', u'-DCMAKE_BUILD_TYPE=Release', u'-DONNX_ML=1', '/tmp/pip-build-XPIwe5/onnx']' returned non-zero exit status 1

----------------------------------------

Command “/usr/bin/python2 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-XPIwe5/onnx/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-ls4trv-record/install-record.txt --single-version-externally-managed --compile --user --prefix=” failed with error code 1 in /tmp/pip-build-XPIwe5/onnx/

Thank you.

Hi,

Please install the following library first:

$ sudo apt-get install libprotobuf-dev protobuf-compiler

And since the compiler cannot find the CUDA toolkit correctly, please also add the path into bashrc:

$ echo 'export PATH=/usr/local/cuda-10.2/bin:$PATH' >> ~/.bashrc
$ echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
$ source ~/.bashrc

Thanks.

1 Like