But when i run the Python API i get following Error:
File "/home/gustav/workspace/TensorRT/tf_to_trt.py", line 10, in <module>
import tensorrt as trt
File "/usr/lib/python2.7/dist-packages/tensorrt/__init__.py", line 53, in <module>
from tensorrt import __versions__
ImportError: cannot import name __versions__
Any Solutions to that? Inside the versions file stands following:
'''
Version information for the TensorRT Python API
'''
package_version = '3.0.1'
infer_lib_version = 301
so_version = '4.0.1'
cudnn_version = '7.0'
Hey dusty_nv, yes i found a very simple solution as it is written in your TensorRT Release Notes (maybe this usefull file should be highlighted a little bit more :) )
You have to import uff and tensorflow before you import tensorrrt (even if you dont use tensorflow in the code)
The reason is said to be:
āWhen using the TensorRT APIs from Python, import the tensorflow and uff
modules before importing the tensorrt module. This is required to avoid a
potential namespace conflict with the protobuf library as well as the cuDNN
version. In a future update, the modules will be fixed to allow the loading of these
Python modules to be in an arbitrary order.ā
Iām getting āModuleNotFoundErrorā error. Iāve ubuntu 16.04 and my GPU is TitanX (Pascal). I tried what pratosha suggested by first importing tesnorflow and uff. But, I canāt even import uff. I installed nv-tensorrt-repo-ubuntu1604-ga-cuda9.0-trt3.0.4-20180208_1-1_amd64.deb and folllowed instructions provided by NVIDIA (Debian Installation): [url]Installation Guide :: NVIDIA Deep Learning TensorRT Documentation and I verify that itās been installed.
Thank you for your reply. I ran those commands and when I run dpkg -l | grep TensorRT I see the output that is provided at section 2 of the installation guide. But, itās not working! My NVidia driver version is 384.111. Do you think thatās causing problem?! Do I need to set a specific environment variable? My environment variables are:
[i]# added by Anaconda3 installer
export PATH=ā/home/administrator/anaconda3/bin:$PATHā
Thank you. I finally got it working. Iād three python installations: python 2.7 coming with ubuntu, python 3.5 coming with ubuntu and anaconda python 3.5 that Iād installed myself. Got rid of Anaconda 3.5 as I couldnāt control where tensorrt is installed and made 3.5 the default one and reinstalled tensorrt, python packages as well as pycuda. Now, itās working.
Unfortunately, you canāt use anaconda with TensorRT but you can still have anaconda on your system. To make tensorRT work I think itās better to figure out what version of Python the tensorRT has been installed under and then make that version your default version and install other libraries under that version (tensorflow, ā¦). You donāt have control where to install tensorRT but youāve control on everything else.
Hi there AastaLLL,
Iām having sort of the same issue, but with CUDA 9.2 and TensorRT 4.
I have numpy version 1.11 on Ubuntu 16.04 x86
When trying to import tensorrt with:
import tensorrt as trt
I get:
ImportError: numpy.core.multiarray failed to import
Then I import numpy.core.multiarray and try again and this time I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/tensorrt/__init__.py", line 53, in <module>
from tensorrt import __versions__
ImportError: cannot import name __versions__
As Iāve seen in this thread I have to import tensorflow and uff first. I had tensorflow for CUDA 9.0 so I gave it a try but canāt import uff or tensorflow due to:
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory