NVIDIA-AI-IOT / tf_to_trt_image_classification

Image classification with NVIDIA TensorRT from TensorFlow models.
BSD 3-Clause "New" or "Revised" License
456 stars 155 forks source link

ImportError: No module named 'graphsurgeon' #33

Open mihg opened 5 years ago

mihg commented 5 years ago

my platform is TX2, dpkg -l | grep TensorRT ii libnvinfer-dev 4.1.3-1+cuda9.0 arm64 TensorRT development libraries and headers ii libnvinfer-samples 4.1.3-1+cuda9.0 arm64 TensorRT samples and documentation ii libnvinfer4 4.1.3-1+cuda9.0 arm64 TensorRT runtime libraries ii tensorrt 4.0.2.0-1+cuda9.0 arm64 Meta package of TensorRT

when run

python scripts/convert_plan.py data/frozen_graphs/inception_v1.pb data/plans/inception_v1.plan input 224 224 InceptionV1/Logits/SpatialSqueeze 1 0 float

it shows

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 36, in from_tensorflow import graphsurgeon as gs ImportError: No module named 'graphsurgeon'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "scripts/convert_plan.py", line 71, in data_type File "scripts/convert_plan.py", line 22, in frozenToPlan text=False, File "/usr/local/lib/python3.5/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 149, in from_tensorflow_frozen_model return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs) File "/usr/local/lib/python3.5/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 41, in from_tensorflow https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/#python and click on the 'TensoRT Python API' link""".format(err)) ImportError: ERROR: Failed to import module (No module named 'graphsurgeon') Please make sure you have graphsurgeon installed. For installation instructions, see: https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/#python and click on the 'TensoRT Python API' link

so how can i fix it?

wangyihuan123 commented 5 years ago

I guess you installed uff python package from TensorRT-4.0.2 not 3.0.4. Please follow the instruction and try pip install TensorRT-3.0.4/uff/uff-0.2.0-py2.py3-none-any.whl I had the similar issue like yours. It was fixed after I downloaded and reinstall 3.0.4 version:

sudo pip uninstall uff sudo pip install TensorRT-3.0.4/uff/uff-0.2.0-py2.py3-none-any.whl

mihg commented 5 years ago

yes,it works. thank you !

Amealsuraj commented 1 year ago

I followed this https://github.com/GeekAlexis/FastMOT/issues/15 No module named 'graphsurgeon' is gone but I am getting new error import graphsurgeon as gs File "/usr/lib/python3.8/dist-packages/graphsurgeon/init.py", line 51, in raise ImportError("""ERROR: Failed to import module ({}) ImportError: ERROR: Failed to import module (No module named 'tensorflow') Please make sure you have TensorFlow installed.