You are not logged in.

#1 2022-12-24 08:38:54

helvetica2
Member
Registered: 2021-08-27
Posts: 9

google.protobuf.internal ImportError when installing python-tensorrt

I've been trying to install python-tensorrt on my machine however I keep getting this issue when running "yay -Sy tensorrt":

...
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/thomas/.cache/yay/tensorrt/src/TensorRT/python/build
[  8%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyAlgorithmSelector.cpp.o
[ 16%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyCore.cpp.o
[ 25%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyFoundationalTypes.cpp.o
[ 33%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyGraph.cpp.o
[ 41%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyInt8.cpp.o
[ 50%] Building CXX object CMakeFiles/tensorrt.dir/src/infer/pyPlugin.cpp.o
[ 58%] Building CXX object CMakeFiles/tensorrt.dir/src/parsers/pyCaffe.cpp.o
[ 66%] Building CXX object CMakeFiles/tensorrt.dir/src/parsers/pyOnnx.cpp.o
[ 83%] Building CXX object CMakeFiles/tensorrt.dir/src/parsers/pyUff.cpp.o
[ 83%] Building CXX object CMakeFiles/tensorrt.dir/src/pyTensorRT.cpp.o
[ 91%] Building CXX object CMakeFiles/tensorrt.dir/src/utils.cpp.o
[100%] Linking CXX shared library tensorrt/tensorrt.so
[100%] Built target tensorrt
awk: cmd. line:1: warning: regexp escape sequence `\#' is not a known regexp operator
awk: cmd. line:1: warning: regexp escape sequence `\#' is not a known regexp operator
awk: cmd. line:1: warning: regexp escape sequence `\#' is not a known regexp operator
awk: cmd. line:1: warning: regexp escape sequence `\#' is not a known regexp operator
Generating python 3.10 bindings for TensorRT 8.5.2.2
~/.cache/yay/tensorrt/src/TensorRT/python/packaging ~/.cache/yay/tensorrt/src/TensorRT/python/build ~/.cache/yay/tensorrt/src/TensorRT/python
~/.cache/yay/tensorrt/src/TensorRT/python/build ~/.cache/yay/tensorrt/src/TensorRT/python
/usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
~/.cache/yay/tensorrt/src/TensorRT/python
* Getting build dependencies for wheel...
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 351, in <module>
    main()
  File "/usr/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 333, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 484, in run_setup
    super(_BuildMetaLegacyBackend,
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
    exec(code, locals())
  File "<string>", line 19, in <module>
  File "/home/thomas/.cache/yay/tensorrt/src/TensorRT/tools/onnx-graphsurgeon/onnx_graphsurgeon/__init__.py", line 1, in <module>
    from onnx_graphsurgeon.exporters.onnx_exporter import export_onnx
  File "/home/thomas/.cache/yay/tensorrt/src/TensorRT/tools/onnx-graphsurgeon/onnx_graphsurgeon/exporters/onnx_exporter.py", line 19, in <module>
    import onnx
  File "/usr/lib/python3.10/site-packages/onnx/__init__.py", line 7, in <module>
    from onnx.external_data_helper import (
  File "/usr/lib/python3.10/site-packages/onnx/external_data_helper.py", line 9, in <module>
    from .onnx_pb import AttributeProto, GraphProto, ModelProto, TensorProto
  File "/usr/lib/python3.10/site-packages/onnx/onnx_pb.py", line 4, in <module>
    from .onnx_ml_pb2 import *  # noqa
  File "/usr/lib/python3.10/site-packages/onnx/onnx_ml_pb2.py", line 5, in <module>
    from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/home/thomas/.local/lib/python3.10/site-packages/google/protobuf/internal/__init__.py)

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
==> ERROR: A failure occurred in build().
    Aborting...
error: target not found: tensorrt
 -> error making: tensorrt (tensorrt python-tensorrt)

It appears as though `google.protobuf.internal` is failing in some manor that's not clear to me. What seems odd though is "builder" seems like a generic term that would be required in whatever it's doing, so I don't understand how to approach this.

Here's my graphics card

$ nvidia-smi 
Sat Dec 24 02:32:03 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.60.11    Driver Version: 525.60.11    CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0  On |                  N/A |
| 34%   28C    P8    22W / 210W |    513MiB /  8192MiB |      2%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       800      G   /usr/lib/Xorg                     264MiB |
|    0   N/A  N/A      1160      G   picom                              34MiB |
|    0   N/A  N/A     15161      G   ...RendererForSitePerProcess      116MiB |
|    0   N/A  N/A     15832      G   ...257382763764797058,131072       95MiB |
+-----------------------------------------------------------------------------+

And here's my installed tensor packages

$ yay -Q | grep tensor
python-tensorboard_plugin_wit 1.8.1-4
python-tensorflow-cuda 2.11.0-1
python-tensorflow-estimator 2.10-1
tensorboard 2.11.0-2
tensorflow-cuda 2.11.0-1

$ pip list | grep tensor
tensorboard                  2.11.0
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.11.0
tensorflow-estimator         2.11.0
tensorflow-gpu               2.11.0
tensorflow-hub               0.12.0
tensorflow-io-gcs-filesystem 0.28.0

I'm really at a loss here and would appreciate any help!

Offline

#2 2022-12-24 15:56:21

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: google.protobuf.internal ImportError when installing python-tensorrt

You have a local installation of python that messes up the build process.

pacman and pip are both package managers and require special care / setup to ensure they don't clash .
Your outputs suggest you are not aware of this.
(If that is correct, the build fail is just a  symptom of bigger issues) .

I advise you to read https://wiki.archlinux.org/title/Python thoroughly .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2022-12-24 16:37:32

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: google.protobuf.internal ImportError when installing python-tensorrt

Moving to AUR issues.  But as Lone_Wolf points out, you need to really research the dichotomy of Python package management on Arch and pick one.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2022-12-24 23:13:29

helvetica2
Member
Registered: 2021-08-27
Posts: 9

Re: google.protobuf.internal ImportError when installing python-tensorrt

Thanks for the replies. Out of curiosity then what would be the path forward? Would I remove my pip installation to remove any packages I installed using pip? I don't know if I want to do this because I rely on virtual environments for a lot of packages (I had originally planned on just using AUR packages however there are a few things I need that are missing).

Offline

#5 2022-12-25 00:36:12

helvetica2
Member
Registered: 2021-08-27
Posts: 9

Re: google.protobuf.internal ImportError when installing python-tensorrt

It looks like the correct thing to do was uninstall protobuf from pip, thanks

Offline

#6 2022-12-25 17:28:49

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: google.protobuf.internal ImportError when installing python-tensorrt

I have to admit that I tend toward the pip and virtual environment solution myself.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB