{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.11","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":91249,"databundleVersionId":11294684,"sourceType":"competition"}],"dockerImageVersionId":31041,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# TensorRT whl for offline installation\n\nThis notebook creates `.whl` file for tensorRT and it's cuda dependencies, so that it can be installed in an offline environment.\n\n\n## Steps to install TensorRT offline\n\n1. Add the output of this notebook as input.\n2. Then run the following commands:\n   ```python\n   !pip install /kaggle/input/tensorrtwhl/nvidia/nvidia_cuda_runtime_cu12-12.9.37-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl\n   !pip install /kaggle/input/tensorrtwhl/nvidia/tensorrt_cu12_bindings-10.11.0.33-cp311-none-manylinux_2_28_x86_64.whl\n   !pip install /kaggle/input/tensorrtwhl/tensorrt_cu12_libs-10.11.0.33/dist/tensorrt_cu12_libs-10.11.0.33-py2.py3-none-manylinux_2_28_x86_64.whl\n   !pip install /kaggle/input/tensorrtwhl/tensorrt_cu12-10.11.0.33/dist/tensorrt_cu12-10.11.0.33-py2.py3-none-any.whl\n   !pip install /kaggle/input/tensorrtwhl/tensorrt-10.11.0.33/dist/tensorrt-10.11.0.33-py2.py3-none-any.whl\n   ```","metadata":{}},{"cell_type":"code","source":"from os import path as osp\n\nPATH_PREFIX = '/kaggle/input/nvidia-tensorrt-install'\n\nPATH_NVIDIA = 'nvidia'\n\nPATH_SOURCE = osp.join(PATH_PREFIX if osp.exists(PATH_PREFIX) else '', PATH_NVIDIA)\n\nPATH_SOURCE","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:51:44.404828Z","iopub.execute_input":"2025-05-22T06:51:44.405424Z","iopub.status.idle":"2025-05-22T06:51:44.410771Z","shell.execute_reply.started":"2025-05-22T06:51:44.405401Z","shell.execute_reply":"2025-05-22T06:51:44.410194Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"VERSION_TRT = '10.11.0.33'","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:51:45.287172Z","iopub.execute_input":"2025-05-22T06:51:45.287391Z","iopub.status.idle":"2025-05-22T06:51:45.290940Z","shell.execute_reply.started":"2025-05-22T06:51:45.287374Z","shell.execute_reply":"2025-05-22T06:51:45.290282Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%pip download --prefer-binary --dest {PATH_NVIDIA} tensorrt=={VERSION_TRT}","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:51:49.020638Z","iopub.execute_input":"2025-05-22T06:51:49.021360Z","iopub.status.idle":"2025-05-22T06:52:52.694916Z","shell.execute_reply.started":"2025-05-22T06:51:49.021331Z","shell.execute_reply":"2025-05-22T06:52:52.694111Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install build","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:52:56.587518Z","iopub.execute_input":"2025-05-22T06:52:56.588331Z","iopub.status.idle":"2025-05-22T06:52:59.973583Z","shell.execute_reply.started":"2025-05-22T06:52:56.588296Z","shell.execute_reply":"2025-05-22T06:52:59.972910Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install ./nvidia/nvidia_cuda_runtime_cu12-12.9.37-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:53:08.694025Z","iopub.execute_input":"2025-05-22T06:53:08.694760Z","iopub.status.idle":"2025-05-22T06:53:12.211632Z","shell.execute_reply.started":"2025-05-22T06:53:08.694732Z","shell.execute_reply":"2025-05-22T06:53:12.210914Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install ./nvidia/tensorrt_cu12_bindings-10.11.0.33-cp311-none-manylinux_2_28_x86_64.whl","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:53:12.212904Z","iopub.execute_input":"2025-05-22T06:53:12.213203Z","iopub.status.idle":"2025-05-22T06:53:15.281323Z","shell.execute_reply.started":"2025-05-22T06:53:12.213179Z","shell.execute_reply":"2025-05-22T06:53:15.280403Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!tar -xzf ./nvidia/tensorrt_cu12_libs-10.11.0.33.tar.gz\n!python -m build --wheel ./tensorrt_cu12_libs-10.11.0.33\n!pip install ./tensorrt_cu12_libs-10.11.0.33/dist/tensorrt_cu12_libs-10.11.0.33-py2.py3-none-manylinux_2_28_x86_64.whl","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:53:15.282895Z","iopub.execute_input":"2025-05-22T06:53:15.283164Z","iopub.status.idle":"2025-05-22T06:54:51.928293Z","shell.execute_reply.started":"2025-05-22T06:53:15.283140Z","shell.execute_reply":"2025-05-22T06:54:51.927450Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!tar -xzf ./nvidia/tensorrt_cu12-10.11.0.33.tar.gz\n!python -m build --wheel ./tensorrt_cu12-10.11.0.33\n!pip install ./tensorrt_cu12-10.11.0.33/dist/tensorrt_cu12-10.11.0.33-py2.py3-none-any.whl","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:54:51.929351Z","iopub.execute_input":"2025-05-22T06:54:51.929638Z","iopub.status.idle":"2025-05-22T06:55:05.760945Z","shell.execute_reply.started":"2025-05-22T06:54:51.929604Z","shell.execute_reply":"2025-05-22T06:55:05.759887Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!tar -xzf ./nvidia/tensorrt-10.11.0.33.tar.gz\n!python -m build --wheel ./tensorrt-10.11.0.33\n!pip install ./tensorrt-10.11.0.33/dist/tensorrt-10.11.0.33-py2.py3-none-any.whl","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:55:05.762765Z","iopub.execute_input":"2025-05-22T06:55:05.762987Z","iopub.status.idle":"2025-05-22T06:55:11.275312Z","shell.execute_reply.started":"2025-05-22T06:55:05.762965Z","shell.execute_reply":"2025-05-22T06:55:11.274510Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import tensorrt as trt\n\ntrt.__version__\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-22T06:55:11.511147Z","iopub.execute_input":"2025-05-22T06:55:11.511375Z","iopub.status.idle":"2025-05-22T06:55:12.064672Z","shell.execute_reply.started":"2025-05-22T06:55:11.511354Z","shell.execute_reply":"2025-05-22T06:55:12.064039Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}