SyntaxError: invalid syntax
See original GitHub issueDescription
Not being able to make
Error message
-- ******** Summary ********
-- CMake version : 3.22.1
-- CMake command : /home/XXX/cmake-3.22.1/bin/cmake
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- C++ compiler version : 7.5.0
-- CXX flags : -Wall -Wno-deprecated-declarations -Wno-unused-function -Wnon-virtual-dtor
-- Build type : Release
-- Compile definitions : SOURCE_LENGTH=39;ONNX_NAMESPACE=onnx2trt_onnx;__STDC_FORMAT_MACROS
-- CMAKE_PREFIX_PATH :
-- CMAKE_INSTALL_PREFIX : /usr/local
-- CMAKE_MODULE_PATH :
--
-- ONNX version : 1.12.0
-- ONNX NAMESPACE : onnx2trt_onnx
-- ONNX_USE_LITE_PROTO : OFF
-- USE_PROTOBUF_SHARED_LIBS : OFF
-- Protobuf_USE_STATIC_LIBS : ON
-- ONNX_DISABLE_EXCEPTIONS : OFF
-- ONNX_WERROR : OFF
-- ONNX_BUILD_TESTS : OFF
-- ONNX_BUILD_BENCHMARKS : OFF
-- ONNXIFI_DUMMY_BACKEND : OFF
-- ONNXIFI_ENABLE_EXT : OFF
--
-- Protobuf compiler : /usr/local/bin/protoc
-- Protobuf includes : /usr/local/include
-- Protobuf libraries : /usr/local/lib/libprotobuf.so;-lpthread
-- BUILD_ONNX_PYTHON : OFF
-- Found CUDA headers at /usr/local/cuda-11.4/include
-- Found TensorRT headers at /home/XXX/opt/TensorRT-8.4.1.5/include
-- Find TensorRT libs at /home/XXX/opt/TensorRT-8.4.1.5/lib/libnvinfer.so;/home/XXX/opt/TensorRT-8.4.1.5/lib/libnvinfer_plugin.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/XXX/Desktop/onnx-tensorrt/build
File "/home/XXX/Desktop/onnx-tensorrt/third_party/onnx/onnx/gen_proto.py", line 35
def process_ifs(lines: Iterable[str], onnx_ml: bool) -> Iterable[str]:
^
SyntaxError: invalid syntax
third_party/onnx/CMakeFiles/gen_onnx_proto.dir/build.make:80: recipe for target 'third_party/onnx/onnx/onnx_onnx2trt_onnx-ml.proto' failed
make[2]: *** [third_party/onnx/onnx/onnx_onnx2trt_onnx-ml.proto] Error 1
CMakeFiles/Makefile2:163: recipe for target 'third_party/onnx/CMakeFiles/gen_onnx_proto.dir/all' failed
make[1]: *** [third_party/onnx/CMakeFiles/gen_onnx_proto.dir/all] Error 2
Makefile:155: recipe for target 'all' failed
make: *** [all] Error 2
Issue Analytics
- State:
- Created a year ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Invalid Syntax in Python: Common Reasons for SyntaxError
The interpreter will find any invalid syntax in Python during this first stage of program execution, also known as the parsing stage. If...
Read more >How to Fix Invalid SyntaxError in Python
The Python SyntaxError occurs when the interpreter encounters invalid syntax in code. When Python code is executed, the interpreter parses ...
Read more >python - Why do I get the syntax error "SyntaxError: invalid ...
When an error is reported on a line that appears correct, try removing (or commenting out) the line where the error appears to...
Read more >SyntaxError: invalid syntax
Python's "invalid syntax" error message comes up often, especially when you're first learning Python. What usually causes this error and how can you...
Read more >SyntaxError in Python: How to Handle Invalid Syntax in Python
In this tutorial, I will teach you how to handle SyntaxError in Python, including numerous strategies for handling invalid syntax in Python.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, now i understand my problem, when the cmake load python, she take python 2.7 and not python 3.6.9 😦 – Found PythonInterp: /usr/bin/python (found version “2.7.17”) – Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython2.7.so (found version “2.7.17”) i changed CMakelist.txt, of Onnx , find_package(PythonInterp ${PY_VERSION} REQUIRED) - > find_package(PythonInterp 3.6.9 REQUIRED) find_package(PythonLibs ${PY_VERSION}) -> find_package(PythonLibs 3.6.9)
Now Onnx compiles fine, but with onnx-tensorrt I have an error, I think I have to change something because when I compile I have this and other errors identical: [ 47%] Building CXX object CMakeFiles/nvonnxparser.dir/builtin_op_importers.cpp.o In file included from /home/databird/Developpement/library/test/onnx-tensorrt/ImporterContext.hpp:8:0, from /home/databird/Developpement/library/test/onnx-tensorrt/ModelImporter.hpp:7, from /home/databird/Developpement/library/test/onnx-tensorrt/NvOnnxParser.cpp:6: /home/databird/Developpement/library/test/onnx-tensorrt/onnx2trt_utils.hpp: In function ‘nvinfer1::IConstantLayer* onnx2trt::addConstantScalar(onnx2trt::IImporterContext*, ScalarType, onnx2trt::ShapedWeights::DataType, nvinfer1::Dims)’: /home/databird/Developpement/library/test/onnx-tensorrt/onnx2trt_utils.hpp:105:21: error: ‘class nvinfer1::INetworkDefinition’ has no member named ‘setWeightsName’; did you mean ‘setName’? ctx->network()->setWeightsName(scalarWeights, scalarWeights.getName());
Maybe my tensorrt version (7.1.3.0). I cloned this depot https://github.com/onnx/onnx-tensorrt/tree/7.1 But it’s a other subject i think we can close this topic. Thanks for your help and your patience. Have a nice day and continue your wonderful work ! 😃
Encountered same issue while trying to build TensorRT-OSS. This issue could be resolved by a simple modification of the
CMakeList.txt
located here:Note line 114, there is a comment like this:
Do what the comment said, uncomment line 116 and comment line 117 & 118:
Then python3 will be picked rather than python2.
The TensorRT-OSS commit hash: a912a045c32a2247b0d1d669962706d28cac7e40