ultralytics / ultralytics

Ultralytics YOLO11 🚀
https://docs.ultralytics.com
GNU Affero General Public License v3.0
31.77k stars 6.09k forks source link

ModuleNotFoundError: No module named 'tensorrt' (during exporting to TensorRT format) #15732

Open dhrhkddns opened 2 months ago

dhrhkddns commented 2 months ago

Search before asking

Ultralytics YOLO Component

No response

Bug

Always thanksful for developing this amazing Ultralytics software :)

To speed up inference when using Ultralytic, I have nvidia graphics card so I decided to use TensorRT. However, when I export the pt file to an engine file, the format says that I can't find the module called tensorrt. Even though I kept the ultralytic package up to date, it's keep causing same error so I'm asking you for a solution.

code_running problem_in_terminal

Environment

PS C:\Users\Administrator\Desktop\segment_detection_combine> yolo checks Ultralytics YOLOv8.2.79 🚀 Python-3.11.9 torch-2.4.0 CUDA:0 (NVIDIA GeForce RTX 4060, 8187MiB) Setup complete ✅ (16 CPUs, 15.8 GB RAM, 52.3/80.0 GB disk)

OS Windows-10-10.0.19045-SP0 Environment Windows Python 3.11.9 Install pip RAM 15.81 GB CPU 13th Gen Intel Core(TM) i5-13400F CUDA 12.4

numpy ✅ 1.26.4<2.0.0,>=1.23.0 matplotlib ✅ 3.9.2>=3.3.0 opencv-python ✅ 4.10.0>=4.6.0 pillow ✅ 10.4.0>=7.1.2 pyyaml ✅ 6.0.1>=5.3.1 requests ✅ 2.32.3>=2.23.0 scipy ✅ 1.14.0>=1.4.1 torch ✅ 2.4.0>=1.8.0 torchvision ✅ 0.19.0>=0.9.0 tqdm ✅ 4.66.5>=4.64.0 psutil ✅ 6.0.0 py-cpuinfo ✅ 9.0.0 pandas ✅ 2.2.2>=1.1.4 seaborn ✅ 0.13.2>=0.11.0 ultralytics-thop ❌ (not installed)>=2.0.0

PS C:\Users\Administrator\Desktop\segment_detection_combine> conda list

packages in environment at D:\a\envs\py311:

#

Name Version Build Channel

blas 1.0 mkl conda-forge brotli 1.1.0 hcfcfb64_1 conda-forge brotli-bin 1.1.0 hcfcfb64_1 conda-forge brotli-python 1.1.0 py311h12c1d0e_1 conda-forge bzip2 1.0.8 h2bbff1b_6
ca-certificates 2024.7.4 h56e8100_0 conda-forge cairo 1.16.0 haedb8bc_5
certifi 2024.7.4 pyhd8ed1ab_0 conda-forge cffi 1.17.0 py311he736701_0 conda-forge charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge contourpy 1.2.1 py311h005e61a_0 conda-forge cuda-cccl 12.6.37 0 nvidia
cuda-cccl_win-64 12.6.37 0 nvidia
cuda-cudart 12.4.127 0 nvidia
cuda-cudart-dev 12.4.127 0 nvidia
cuda-cupti 12.4.127 0 nvidia
cuda-libraries 12.4.0 0 nvidia
cuda-libraries-dev 12.4.0 0 nvidia
cuda-nvrtc 12.4.127 0 nvidia
cuda-nvrtc-dev 12.4.127 0 nvidia
cuda-nvtx 12.4.127 0 nvidia
cuda-opencl 12.6.37 0 nvidia
cuda-opencl-dev 12.6.37 0 nvidia
cuda-profiler-api 12.6.37 0 nvidia
cuda-runtime 12.4.0 0 nvidia
cuda-version 12.6 3 nvidia
cycler 0.12.1 pyhd8ed1ab_0 conda-forge eigen 3.4.0 h91493d7_0 conda-forge expat 2.6.2 h63175ca_0 conda-forge filelock 3.15.4 pyhd8ed1ab_0 conda-forge fontconfig 2.14.1 hb33846d_3
fonttools 4.53.1 py311he736701_0 conda-forge freetype 2.12.1 ha860e81_0
glib 2.78.4 hd77b12b_0
glib-tools 2.78.4 hd77b12b_0
graphite2 1.3.14 hd77b12b_1
gst-plugins-base 1.22.3 hfc3ed34_1
gstreamer 1.22.3 h1779075_1
h2 4.1.0 pyhd8ed1ab_0 conda-forge harfbuzz 4.3.0 hb646838_2 hdf5 1.12.1 h51c971a_3 hpack 4.0.0 pyh9f0ad1d_0 conda-forge hyperframe 6.0.1 pyhd8ed1ab_0 conda-forge icc_rt 2022.1.0 h6049295_2 icu 73.2 h63175ca_0 conda-forge idna 3.7 pyhd8ed1ab_0 conda-forge intel-openmp 2021.4.0 pypi_0 pypi jinja2 3.1.4 pyhd8ed1ab_0 conda-forge jpeg 9e h8ffe710_2 conda-forge kiwisolver 1.4.5 py311h005e61a_1 conda-forge krb5 1.20.1 heb0366b_0 conda-forge lapx 0.5.9.post1 pypi_0 pypi lcms2 2.15 ha5c8aab_0 conda-forge lerc 3.0 h0e60522_0 conda-forge libabseil 20240116.2 cxx17_he0c23c2_1 conda-forge libblas 3.9.0 1_h8933c1f_netlib conda-forge libbrotlicommon 1.1.0 hcfcfb64_1 conda-forge libbrotlidec 1.1.0 hcfcfb64_1 conda-forge libbrotlienc 1.1.0 hcfcfb64_1 conda-forge libcblas 3.9.0 5_hd5c7e75_netlib conda-forge libclang 14.0.6 default_hb5a9fac_1 libclang13 14.0.6 default_h8e68704_1 libcublas 12.4.2.65 0 nvidia libcublas-dev 12.4.2.65 0 nvidia libcufft 11.2.0.44 0 nvidia libcufft-dev 11.2.0.44 0 nvidia libcurand 10.3.7.37 0 nvidia libcurand-dev 10.3.7.37 0 nvidia libcusolver 11.6.0.99 0 nvidia libcusolver-dev 11.6.0.99 0 nvidia libcusparse 12.3.0.142 0 nvidia libcusparse-dev 12.3.0.142 0 nvidia libdeflate 1.17 hcfcfb64_0 conda-forge libexpat 2.6.2 h63175ca_0 conda-forge libffi 3.4.4 hd77b12b_1 libglib 2.78.4 ha17d25a_0 libhwloc 2.11.1 default_h8125262_1000 conda-forge libiconv 1.17 hcfcfb64_2 conda-forge libjpeg-turbo 2.1.4 hcfcfb64_0 conda-forge liblapack 3.9.0 5_hd5c7e75_netlib conda-forge libnpp 12.2.5.2 0 nvidia libnpp-dev 12.2.5.2 0 nvidia libnvfatbin 12.6.20 0 nvidia libnvfatbin-dev 12.6.20 0 nvidia libnvjitlink 12.4.99 0 nvidia libnvjitlink-dev 12.4.99 0 nvidia libnvjpeg 12.3.1.89 0 nvidia libnvjpeg-dev 12.3.1.89 0 nvidia libogg 1.3.5 h2466b09_0 conda-forge libpng 1.6.39 h8cc25b3_0 libpq 12.17 h906ac69_0 libprotobuf 4.25.3 hf2fb9eb_0 libtiff 4.5.1 hd77b12b_0 libuv 1.48.0 hcfcfb64_0 conda-forge libvorbis 1.3.7 h0e60522_0 conda-forge libwebp-base 1.4.0 hcfcfb64_0 conda-forge libxml2 2.13.1 h24da03e_2 lz4-c 1.9.4 hcfcfb64_0 conda-forge m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge markupsafe 2.1.5 py311ha68e1ae_0 conda-forge matplotlib-base 3.9.2 py311h8f1b1e4_0 conda-forge mkl 2023.1.0 h6a75c08_48682 conda-forge mpmath 1.3.0 pyhd8ed1ab_0 conda-forge msys2-conda-epoch 20160418 1 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge networkx 3.3 pyhd8ed1ab_1 conda-forge numpy 1.26.4 py311h0b4df5a_0 conda-forge onnx 1.16.2 pypi_0 pypi opencv 4.10.0 py311h66e330a_0 openjpeg 2.5.2 hae555c5_0 openssl 3.3.1 h2466b09_2 conda-forge openvino 2024.3.0 pypi_0 pypi openvino-telemetry 2024.1.0 pypi_0 pypi packaging 24.1 pyhd8ed1ab_0 conda-forge pandas 2.2.2 py311hcf9f919_1 conda-forge patsy 0.5.6 pyhd8ed1ab_0 conda-forge pcre2 10.42 h0ff8eda_1 pillow 10.4.0 py311h827c3e9_0 pip 24.2 py311haa95532_0 pixman 0.43.4 h63175ca_0 conda-forge protobuf 5.27.3 pypi_0 pypi psutil 6.0.0 py311he736701_0 conda-forge pthreads-win32 2.9.1 hfa6e2cd_3 conda-forge py-cpuinfo 9.0.0 pyhd8ed1ab_0 conda-forge pycparser 2.22 pyhd8ed1ab_0 conda-forge pygame 2.6.0 pypi_0 pypi pyparsing 3.1.2 pyhd8ed1ab_0 conda-forge pysocks 1.7.1 pyh0701188_6 conda-forge python 3.11.9 he1021f5_0 python-dateutil 2.9.0.post0 pypi_0 pypi python-tzdata 2024.1 pyhd8ed1ab_0 conda-forge python_abi 3.11 2_cp311 conda-forge pytorch 2.4.0 py3.11_cuda12.4_cudnn9_0 pytorch pytorch-cuda 12.4 h3fd98bf_6 pytorch pytorch-mutex 1.0 cuda pytorch pytz 2024.1 pyhd8ed1ab_0 conda-forge pyyaml 6.0.1 pypi_0 pypi qhull 2020.2 hc790b64_5 conda-forge qt-main 5.15.2 h19c9488_10 requests 2.32.3 pyhd8ed1ab_0 conda-forge scipy 1.14.0 py311hd4686c6_2 conda-forge seaborn 0.13.2 hd8ed1ab_2 conda-forge seaborn-base 0.13.2 pyhd8ed1ab_2 conda-forge setuptools 72.1.0 py311haa95532_0 six 1.16.0 pyh6c4a22f_0 conda-forge sqlite 3.45.3 h2bbff1b_0 statsmodels 0.14.2 py311h0a17f05_0 conda-forge sympy 1.13.1 pypi_0 pypi tbb 2021.13.0 pypi_0 pypi tk 8.6.14 h0416ee5_0 torchvision 0.19.0 pypi_0 pypi tqdm 4.66.5 pyhd8ed1ab_0 conda-forge typing_extensions 4.12.2 pyha770c72_0 conda-forge tzdata 2024a h04d1e81_0 ucrt 10.0.22621.0 h57928b3_0 conda-forge ultralytics 8.2.79 pyh1669911_0 conda-forge urllib3 2.2.2 pyhd8ed1ab_1 conda-forge vc 14.40 h2eaa2aa_0 vc14_runtime 14.40.33810 ha82c5b3_20 conda-forge vs2015_runtime 14.40.33810 h3bf8584_20 conda-forge wheel 0.43.0 py311haa95532_0 win_inet_pton 1.1.0 pyhd8ed1ab_6 conda-forge xz 5.4.6 h8cc25b3_1 yaml 0.2.5 h8ffe710_2 conda-forge zlib 1.2.13 h8cc25b3_1 zstandard 0.22.0 py311he5d195f_0 conda-forge zstd 1.5.5 hd43e919_2

Minimal Reproducible Example

from ultralytics import YOLO

Load the YOLOv8 model

model = YOLO("yolov8n.pt")

Export the model to TensorRT format

model.export(format="engine") # creates 'yolov8n.engine'

Additional

No response

Are you willing to submit a PR?

Y-T-G commented 2 months ago

Try pip install tensorrt