upgrading protobuf tensorflow on jetson tx2 - c++

To give as much background as possible -
I have a machine learning model trained using keras i'm trying to embed on an nvidia jetson tx2.
I have set up tensorflow on there (a bit of a pain in itself) however when i run my script i'm hitting an error with protobuf.
Using TensorFlow backend.
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.1.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/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.1.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/src/google/protobuf/any.pb.cc".)
Aborted (core dumped)
So - i upgraded protobuf using pip at first but i thought the clash is because c++ version is taking priority and the version in linux was still stating 2.6.1 however after building in c++ the version is now shown as 3.1.0 however i am still getting the same error.
From the nvidia dev forums i received some feedback
"/usr/lib/aarch64-linux-gnu/libprotobuf.so.9.0.1
This means that C/C++ code will find version 2.6.
pip install protobuf-3.1.0-py2.py3-none-any.whl
This means that Python code will find version 3.1.
You need to upgrade the C++ (system) library to match version 3.1.
I don't think there's a default package on Ubuntu that does this, so you will have to either hack it by building your own and installing it on top of the system package, or you will have to find a deb package that has a newer version that will still install on your current system."
Ive really been struggling with this as i cant find a way to upgrade the system files. Any help would be much appreciated
Thanks
edit: i'm also wondering could this be a clash with GTK (i am also using openCV here so thats worth a mention!)

Please check your version of libprotobuf-dev.
Please try to uninstall your existing one on your PC with following commands:
apt-get remove --purge libprotobuf-dev
Then, build new version of libprotobuf-dev:
apt-get install autoconf automake libtool curl make g++ unzip
wget https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.tar.gz
tar -xvf protobuf-cpp-3.5.0.tar.gz
cd protobuf-3.5.0
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig
Good luck.
References:
https://github.com/BVLC/caffe/issues/5711
https://github.com/google/protobuf/issues/2979

step 1:
first, uninstall with purge protobuf
sudo apt-get remove --purge libprotobuf
step 2:
start a fresh one
$ wget https://raw.githubusercontent.com/jkjungavt/jetson_nano/master/install_protobuf-3.6.1.sh
sudo chmod +x install_protobuf-3.6.1.sh
./install_protobuf-3.6.1.sh #this time will take 30 min on my board.

Related

RedHawk building from source --- locate the code installing uhd3.5.3

I am trying to build from source for RedHawk installation and trying to replace uhd3.5.3 with a higher version of uhd for USRP_UHD module. I saw USRP_UHD source code, but found nowhere for uhd3.5.3 source code. I am guessing it might simply use "yum install ..." to download and install uhd host code and suporting libraries. Does anybody know where this code is located in redhawk_src_2.0 package? Or is there an efficient way in linux to search for this among all the files in redhawk_src_2.0 package?
Thanks in advance!
UHD is the USRP Harware driver softwware from Ettus Research. The UHD is distributed from:
http://files.ettus.com/binaries/uhd_stable/
Version 3.5.3 is here:
http://files.ettus.com/binaries/uhd_stable/uhd_003.005.003-release/
The current release is 3.9.2:
http://files.ettus.com/binaries/uhd_stable/uhd_003.009.002-release/
Hopefully this helps. I wasn't 100% sure what you are asking for.
First, clone the uhd library:
git clone git://github.com/EttusResearch/uhd.git
Then checkout the 3.9.2 tag:
git checkout release_003_009_002
Using the instructions from Ettus (http://files.ettus.com/manual/page_build_guide.html), install the dependencies listed under the Fedora section:
sudo yum -y install boost-devel libusb1-devel python-mako doxygen python-docutils cmake make gcc gcc-c++
Next, generate the Makefiles with CMake:
cd <uhd-repo-path>/host
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/uhd ../
I recommend using an alternate install prefix at first to preserve the 3.5.3 version, just in case, but if you don't want to, just run:
cmake ../
instead of the longer command with the -DCMAKE_INSTALL_PREFIX flag. (Note: I couldn't get cmake to find the installed boost version, so you may have to do some other research on that since it is probably a whole different stackoverflow post in and of itself)
Now build and install the uhd library:
make
make test
sudo make install
Now that the library is installed, you should edit the USRP_UHD/cpp/configure.ac so that the PKG_CONFIG_PATH points to your install prefix (either the one specified in the flag above, or if you did the default, just leave it, as it should already be pointing to /usr/local/lib/pkgconfig). Also in the configure.ac file, make sure to change the uhd version number to 3.9.2.
Now you should be able to rebuild the USRP_UHD Device:
./reconf && ./configure && make install
I don't guarantee that the Device will build against the new version of the uhd library, that will depend on what (if anything) has been deprecated an removed from the library between the supported version and the newest one.
Finally, if you get through all of those steps successfully and if you specified a non-standard install prefix, you will have to add this prefix to either the LD_LIBRARY_PATH or an /etc/ld.so.conf.d/ script in order for the Device to correctly execute.
Clarification - you can follow the Redhawk manual appendix B for building Redhawk from source AFTER installing UHD v3.9.3 from source as per pwolframs instructions. The UHD v3.5.3 is not packaged with the Redhawk source code, only the Redhawk RPM, disregard all those RPMs when building UHD and Redhawk from source.

Unable to locate package GLFW on Linux Mint

I have been trying to install GLFW and GLFW3, using Terminal to install
sudo apt-get install GLFW
sudo apt-get install GLFW3
Whenever I do so, I get results such as
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package glfw3
I have been trying to install GLFW for two hours now, and I'm getting a bit impatient. Also I'm very new to Linux (Mint), so I apologize if I'm doing something stupid...
EDIT:
No matter what I try, my program encounters
/home/myusername/Desktop/basic_window.cpp:11:21: fatal error: GL/glfw.h: No such file or directory
#include <GL/glfw.h>
^
compilation terminated.
Having a frustrating time with this, not sure why this is much more complicated than the other libraries I've installed so far.
I have been trying to install GLFW and GLFW3, using Terminal to install...
On Mint 17, it looks like you need to install libglfw2. So perform a sudo apt-get install libglfw2.
If you plan on developing against it, then install libglfw-dev instead. Notice the lack of a version number.
If interested, perform apt-cache search glfw
In Debian-based systems such as Ubuntu and Mint, library packages typically have names that begin with "lib", and development headers (for compiling new programs that use the library) are in a separate package whose name ends with "-dev".
Ubuntu 14.04 has GLFW 2 packaged as libglfw2 and libglfw-dev. Mint doesn't seem to have those packages, but you can probably use the Ubuntu ones since Mint 17 is based on Ubuntu 14.04.
GLFW 3 isn't in Ubuntu 14.04, but it looks like it'll be in 14.10 (as libglfw3 and libglfw3-dev).
Unless you really need GLFW 3 specifically, you're probably better off sticking with the packaged GLFW 2. Packages get easy automatic upgrades; compiling stuff "by hand" is a good way to end up with lots of cruft in your system with no automatic upgrade or uninstall.
Download GLFW source packages from their website.
Extract the folder glfw-3.0.4 from the tarball
Open console
Navigate to the folder you just extracted and go inside of it using cd
Type cmake . (be sure you include the dot)
If cmake . fails, then type the following as root:
apt-get install cmake
If you don't think you're root then type the following:
sudo apt-get install cmake
If that doesn't work then type the following as root, or add sudo if you're not root:
apt-get install build-essential cmake
Once you have cmake installed, navigate back to the folder and try cmake . again.

Matplotlib install issues. Pip Centos - Freetype "Missing" when it is installed

I am using a virtualenv for a django setup. I am trying to build a view that pulls data from logs and then graphs the data. Eventually I would like to have this real-time and live. If you have any recommendations on other solutions that would suit my project best, please do not hesitate to include them in the comment fields below.
I have attempted to install matplotlib from pip using pip install matplotlib.
I receive the following message:
* The following required packages can not be built:
* freetype
I then validated that it was installed
yum install freetype
Package freetype-2.3.11-14.el6_3.1.x86_64 already installed and latest version
I then found that there is a python-matplotlib which is an older version .99. However, I want to keep this inside of the virtual environment and not system wide.
find / -name *freetype*
/var/lib/yum/yumdb/f/d2807dcfe3762c0b9f8ef1d9bf0f05788e73282a-freetype-2.3.11-14.el6_3.1- x86_64
/usr/lib64/libfreetype.so.6.3.22
/usr/lib64/libfreetype.so.6
/usr/share/doc/freetype-2.3.11
I searched all over stackoverflow and only saw solutions for ubuntu which did not transfer over to centos.
Thank you for your time,
John
pip is going to compile matlibplot on your local machine, so you'll need freetype development headers installed as well.
CentOS 6+, Fedora, etc.:
$ sudo yum -y install freetype freetype-devel libpng-devel
On older operating systems (e.g. CentOS 5), you may run into a more specific freetype versioning issue with newer releases of matlibplot. If you're version agnostic, sticking with a legacy 1.3.x release will negate these dependency issues:
$ pip install matplotlib==1.3.1
Please note, you may need to downgrade your numpy to 1.8 in order to make matplotlib 1.3 work.
$ pip install numpy==1.8
Good luck!
I have just had a similar (albeit not exactly the same) situation. I'll write it up here as this page comes up among the first search results.
CentOS 5
pip install matplotlib complains about freetype
Both freetype and freetype-devel are installed.
~/.pip/pip.log provides the explanation of the problem. There is the line:
freetype: no [Requires freetype2 2.3 or later. Found 2.2.1.]
Obviously, the solution is either to upgrade freetype or downgrade matplotlib.
The second is easier (assuming I am OK with the older version).
pip install matplotlib==1.3.1 works fine.
On the matplotlib installation, this is what I did. Not sure if this is going to help you. Just followed the steps here:
http://pkgs.org/centos-6/centos-x86_64/python-matplotlib-0.99.1.2-1.el6.x86_64.rpm.html
I did not use pip, btw and have CentOS 6.4.
I had this happen to me in two different situations, see if yours is one of them:
freetype was installed, but not in the $PATH yet. Just exiting the shell and starting a new one fixed this.
I was building matplotlib from source, and trying to build from the master branch. After I switched to v1.3.x it correctly detected freetype.

Install boost version 1.40

I am using a server running with Ubuntu 12.04
I want to install the boost libraries in it. I know
sudo apt-get install libboost-all-dev
will make the work done, but it installs the latest version version 1.52 or above.
But I need to install the particular version 1.40 as there is a problem in a simulator which I am using for my academic purpose. What is the particular command for that so that I can install the boost libraries along with the other requirements for it like the linking files
Thanks in advance
Quick answer: sudo apt-get install libboost-dev= 1.40.0.1
If it doesn't work, continue reading.
The apt-get does support installing a particular version of a package as long as it is in an archive that apt knows about. From the apt-get manpage:
A specific version of a package can be selected for installation by following the
package name with an equals and the version of the package to select. This will
cause that version to be located and selected for install. Alternatively a specific
distribution can be selected by following the package name with a slash and the version of
the distribution or the Archive name (stable, frozen, unstable).
For e.g. if you wanted to install apache 2.20 for Ubuntu, you would do something like:
sudo apt-get install apache2=2.2.20-1ubuntu1
Note that you may need to do some dependency resolution on your own in this case, but if there are any problems apt-get will tell you what is causing them. For e.g.(on 11.04)
sudo apt-get install apache2=2.2.20-1ubuntu1 \
apache2.2-common=2.2.20-1ubuntu1 \
apache2.2-bin=2.2.20-1ubuntu1 \
apache2-mpm-worker=2.2.20-1ubuntu1
Note: You must first check if build 1.40 is still available. For that use:
aptitude search libboost
If aptitude search command don't give you sufficient results, try sudo aptitude update and then run aptitude search again.
You might have to investigate whether debs from earlier Ubuntu versions can be installed. i.e. remove the current package, download the debs and try installing them. But there could be dependency on older versions of the standard library.If so, you can probably try downloading the source from launchpad.
As a last resort, download from boost.org and build it - painfully!
EDIT: I see you have asked the same question on ubuntu forums and it seems that you have 1.48 as the default. You might have to build the library itself. Can you try this apt-get
sudo apt-get install libboost1.40-all-dev=1.40.0-4ubuntu4
If this doesn't work, you will have to build it and install it yourself. You can download the source from
Download source (1.40.0): libboost 1.40.0 source files
After it's installed, run the following command to hold your installed version, preventing the package manager from automatically updating it in the future:
sudo echo "[packagename] hold" | sudo dpkg --set-selections
Source:How to Downgrade Packages on Ubuntu
Generally you download sources, build it (some parts are not just headers like filesystem on Windows). Then you can select which subset of libraries you want to install (you can make compact version with only what you need). Then by invoking bootstrap script you build it to another directory this subset of libraries you want and then you invoke install.
Here is a pretty good description how to do it: http://ubuntuforums.org/showthread.php?t=1180792

Failed to compile wxWidgets-2.9.2 on Kubuntu11.10(64bit) with '--with-opengl' flag

I tried to compile wxWidgets-2.9.2 with opengl support by calling
configure --with-opengl
But it failed when the configure script tried to locate the lib files of opengl
checking for GL/gl.h... yes
checking for GL/glu.h... yes
checking for -lGL... no
checking for -lMesaGL... no
configure: error: OpenGL libraries not available
However, I checked /usr/lib and found that there is libGL.so in that directory. Actually, before trying to compile wxWidgets-2.9.2, I had written several opengl programs and all were successfully compiled and run. Could someone help me to fix this?
This is actually a bug in the configure script, please see
http://trac.wxwidgets.org/ticket/13375.
The solution is to download the latest codes from
http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk/
Or you can select to overwrite only the configure,acinclude.m4 files.
Have you tried installing the free implementation?
sudo apt-get install libglw1-mesa libglw1-mesa-dev
Are you running proprietary drivers from Nvidia or something? I think it messes around with the OpenGL environment while installing. Perhaps, it is worth trying to go back the the opensource ones if this is the case.
There is also a know issue OpenGL libs not located by 'configure' in debian testing
First of all check if opengl libs are installed! them --->
we need to change Configure file on source! check this link:
http://trac.wxwidgets.org/ticket/13376
the same issues arise on ubuntu 12.04!
I also met the same problem when trying to compile wxWidgets3.1.0 --with-opengl on Debian Jessie x86_64. I tried
SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s#include#$wx_cv_std_libpath#g` /usr/$
wx_cv_std_libpath /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu"
and
pkg-config --variable=libdir gl
/usr/lib/x86_64-linux-gnu
and
sudo apt-get install libglw1-mesa libglw1-mesa-dev
but:
OpenGL libraries not available
I then tried
sudo apt-get install glutg3-dev
but:
glutg3-dev is not found.
So I searched for the alternative to glutg3-dev in Jessie and I tried
sudo apt-get install freeglut3-dev
then it worked!
Installing mesa didn't help for me, but installing glutg3-dev did the trick
sudo apt-get install glutg3-dev