tensorflow on tx2 protobuf - tensorflow

Hi i have installed tensorflow using
https://devtalk.nvidia.com/default/topic/1038957/jetson-tx2/tensorflow-for-jetson-tx2-/post/5278617/#5278617
when i run the python script i get the following error:
libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
Aborted (core dumped)
pip show protobuf i get Version: 3.6.1
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: protobuf#googlegroups.com
Author-email: protobuf#googlegroups.com
License: 3-Clause BSD License
Location: /home/nvidia/vitualenv/lib/python2.7/site-packages
Requires: setuptools, six
Required-by: tensorflow-gpu, tensorboard
someone have some ideas how to solve this?
Thanks

Finally i got it worked. In the end i have to import tensorflow at the beginning of the python file. No other solution worked for me except this one.
I do not understand why.
If someone know the answer can you please explain me why?
Thanks

Related

Google Colab Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0

While training with Tensorflow 2 Object Detection API in Google Collab, I get the following errors:
2022-03-07 15:27:51.475298: E tensorflow/stream_executor/cuda/cuda_dnn.cc:359] Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0. CuDNN library needs to have matching major version and equal or higher minor version. If using a binary install, upgrade your CuDNN library. If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
2022-03-07 15:27:51.477142: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at conv_ops.cc:1120 : UNKNOWN: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
I have tried updating my CuDNN library in Google collab, using this StackOverflow answer:
Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0. when using google colab.
However, this does not solve the issue.
I am using Tensorflow 2.7.0.
The following is a workaround for the problem, as posted on the official Github
This may not work always and may not be safe, but as a workaround for the time being, you may try running !apt install --allow-change-held-packages libcudnn8=8.1.0.77-1+cuda11.2

Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0

I get this error when I run the model.fit_generator code to train images using the CNN model. I don't understand the error, and what should I do? Can anyone help me?
this is the full error description
`Loaded runtime CuDNN library: 8.0.5, but the source was compiled with: 8.1.0. CuDNN library needs to have a matching major version and equal or higher minor version. If using a binary install, upgrade your CuDNN library. If building from sources, ensure the library loaded at runtime is compatible with the version specified during compile configuration.
I had the same error "tensorflow/stream_executor/cuda/cuda_dnn.cc:362] Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0."
I solved it by downgrading the TensorFlow version, here it says that you use a new version of TensorFlow that is not compatible with the google colab CuDNN version. I used TensorFlow 2.4.0 plus all the dependence required on version 2.4.0.
Here it says which version of TensorFlow to use for cudnn compatibility, https://www.tensorflow.org/install/source
You should always have version of libraries installed that is matching the version dependency you want to use is compiled with.
You can download the version you need from nvidia website or use conda for package management. It will handle all dependencies for you.
You can miniconda and type conda install -c anaconda tensorflow-gpu to get it sorted for you. If you need a specific version of python, you can create environment with it.
My solution:
After confirming that my cuda and cudnn versions are compatible with tensorflow, I first thought that the system did not synchronize after the installation was completed. After several restarts, it was found that it was not and could not be the problem, so I started to check all the cuda in the system. For the software that depends on cudnn, matlab was uninstalled during the period but it was useless. Later, I thought that pytorch is also related to cuda and cudnn. I checked the version of pytorch and found that I was using torch 1.8, and the cuda it was adapted to was 11.1 , The corresponding cudnn is 8.0.5, now the case is solved. Finally upgraded pytorch and solved it.
I have faced the same issue. It seems like if TensorFlow versions requires specific cuDNN version.
Check the link for required versions.
https://www.tensorflow.org/install/source#gpu
Thanks for This answer.
My solution:
After confirming that my cuda and cudnn versions are compatible with
tensorflow, I first thought that the system ...
It helps me a lot,but I use different way to solve this problem.
I found that pytorch 1.8 is compatible with cudnn 8.1.0. So, instead of upgrade pytorch version, I overwrite the cudnn 8.0.5 dll library with cudnn 8.1.0 in directory D:\Program Files\Python37\Lib\site-packages\torch\lib. You can find this location with Everything, which is always helpful.

Chainer: No module named 'cupy.util'`

I am getting desperate with Chainer because I'm not able to use it with GPU for about a week now. The error I am getting:
RuntimeError: CUDA environment is not correctly set up (see https://github.com/chainer/chainer#installation).No module named 'cupy.util'
Code to reproduce:
import chainer
chainer.cuda.to_gpu([0, 0])
Output of chainer.backends.cuda.available is False.
Working on Ubuntu 20.04 (I know, it is not the one from the recommended on Chainer's docs) inside WSL2. CUDA drivers 11.0. Output of nvcc -V:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Wed_Jul_22_19:09:09_PDT_2020
Cuda compilation tools, release 11.0, V11.0.221
Build cuda_11.0_bu.TC445_37.28845127_0
CUDA samples compile and work properly inside WSL2.
According to pip freeze, cupy-cuda110 is installed within an (activated) virtual environment (but not detected, it seems). Chainer version 7.7.0 is installed.
Any ideas how to fix it?
Solution from https://github.com/chainer/chainer/issues/8582 did not seem to do the trick for me.
The error message is very clear. Just change L69 of backends/cuda.py:
from cupy.util import PerformanceWarning as _PerformanceWarning
to
from cupy._util import PerformanceWarning as _PerformanceWarning
along with the solution from #8582, everything will work just fine.

Which version of protoc should I need?

When I ran the gem5 in a server, the error appeared.
[libprotobuf FATAL google/protobuf/stubs/common.cc:68] This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 3.4.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "build/X86_MESI_Two_Level/proto/inst_dep_record.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 3.4.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "build/X86_MESI_Two_Level/proto/inst_dep_record.pb.cc".)
Aborted (core dumped)
According to the error information, I need version 3.5.0 of libprotobuf. But when I ran the command protoc --version, The output is "libprotoc 3.5.0" which shows that I already have version 3.5.0.
The same code can be run in another server. I run the command protoc --version in that server. It shows
"libprotoc 2.6.1".

How to see tensorflow build configuration?

I am trying to build tensorflow from source on a remote server (with no superuser privileges) because I got this error when I simply installed with pip:
Loaded runtime CuDNN library: 7.1.2 but source was compiled with: 7.4.2. CuDNN library major and minor version needs to match or have higher minor version in case of CuDNN 7.0 or later version. If using a binary install, upgrade your CuDNN library. If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
I completed all the steps listed here successfully, but I still get the same error as above, despite setting CudNN version as 7.1.2 before building.
Is there any way I can see the configurations to verify that they have been set properly?
A file is generated after running ./configure with the name .tf_configure.bazelrc you can inspect that file.