Install tensorrt with custom plugins - tensorrt

I'm able to install the desired version of TensorRT from official nvidia guide (https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#maclearn-net-repo-install)
sudo apt-get update && \
apt-get install -y libnvinfer7=7.1.3-1+cuda10.2 libnvonnxparsers7=7.1.3-1+cuda10.2 libnvparsers7=7.1.3-1+cuda10.2 libnvinfer-plugin7=7.1.3-1+cuda10.2 libnvinfer-dev=7.1.3-1+cuda10.2 libnvonnxparsers-dev=7.1.3-1+cuda10.2 libnvparsers-dev=7.1.3-1+cuda10.2 libnvinfer-plugin-dev=7.1.3-1+cuda10.2 python3-libnvinfer=7.1.3-1+cuda10.2 && \
sudo apt-mark hold libnvinfer7 libnvonnxparsers7 libnvparsers7 libnvinfer-plugin7 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev python3-libnvinfer
But I need some custom plugins. Fortunately I found the desired and added to folder plugin
https://github.com/NVIDIA/TensorRT/tree/master/plugin and registered it.
Now I do not understand how to build and install tensorrt with added plugin.
On the official repo on github https://github.com/NVIDIA/TensorRT there is an instruction, but it describes steps to build a docker image with tensorrt.
So the question is how to build tensorrt with custom plugin and install it on ubuntu?

It's quite easy to "install" custom plugin if you registered it.
So the steps are the following:
Install tensorRT
sudo apt-get update && \
apt-get install -y libnvinfer7=7.1.3-1+cuda10.2 libnvonnxparsers7=7.1.3-1+cuda10.2 libnvparsers7=7.1.3-1+cuda10.2 libnvinfer-plugin7=7.1.3-1+cuda10.2 libnvinfer-dev=7.1.3-1+cuda10.2 libnvonnxparsers-dev=7.1.3-1+cuda10.2 libnvparsers-dev=7.1.3-1+cuda10.2 libnvinfer-plugin-dev=7.1.3-1+cuda10.2 python3-libnvinfer=7.1.3-1+cuda10.2 && \
sudo apt-mark hold libnvinfer7 libnvonnxparsers7 libnvparsers7 libnvinfer-plugin7 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev python3-libnvinfer
Note: I installed v.7.1.3.1 of tensorrt and cuda 10.2 if you want to install other version change it but be careful the version of tensorRT and cuda match in means that not for all version of tensorRT there is the version of cuda
Build the library libnvinfer_plugin.so.x.x.x as described at https://github.com/NVIDIA/TensorRT
Note: x.x.x is the version of library in my case is 7.1.3
Delete existing libraries at /usr/lib/x86_64-linux-gnu if you have x86 architecture or /usr/lib/aarch64-linux-gnu for arm64:
libnvinfer_plugin.so.7.1.3
libnvinfer_plugin.so.7
libnvinfer_plugin.so
Again file names depends on tensorRT version.
Copy the library libnvinfer_plugin.so.7.1.3 to folder /usr/lib/x86_64-linux-gnu if you have x86 architecture or /usr/lib/aarch64-linux-gnu for arm64
Make simlinks for libraries:
sudo ln -s libnvinfer_plugin.so.7
sudo ln -s libnvinfer_plugin.so.7 libnvinfer_plugin.so

Related

Installing R 4.1 from source on newly installed Ubuntu 20.04

I tried to install R 4.1 on a newly set-up Ubuntu 20.04. After some struggle with the repositories and keys, I chose to install from source.
Visited https://www.r-project.org/ to download latest version of R. Ran ./configure multiple times to note the requirement of various libraries which you may note as follows. I am hoping this will save significant amount of time for anyone intending to build from source. Suggestions welcome for speeding up the process or better solution. However my intention is to share entire set of libraries that I had to install on a naked installation of 20.04 on which the very first package I tried to install was R 4.1 (from source).
Directory where you downloaded the tar.gz (e.g. R-4.1.2.tar.gz in my case)
cd Downloads
Untar
tar -xvzf R-4.1.2.tar.gz
Enter directory
cd R-4.1.2
As root
sudo su
Try validating configuration (encountered many errors throughout and following libraries were installed)
./configure
Installed various libraries:
apt-get install build-essential
apt-get install gfortran
apt-get install fort77
apt-get install libreadline-dev
apt-get install xorg-dev
apt-get install liblzma-dev libblas-dev
apt-get install gcc-multilib
apt-get install libbz2-dev
apt-get install libpcre2-dev
apt-get install libcurl4-openssl-dev
apt install default-jdk
make
make install
The above set worked for me and I am hopeful it may be of help.

How to install newer version of R on Amazon Linux 2

For whatever reason, Amazon moved R to the so-called "Extras Library" so you can't install R using sudo yum install -y R anymore. Instead, you have to do sudo amazon-linux-extras install R3.4. As a result, I can only install R 3.4.3 when the newest stable release is 3.6.1, and so many R libraries can't even be installed because the version is too low. Is there any good and clean way to install the latest version of R and skip Amazon's package manager? Thanks!
Use amazon-linux-extras which installs R4.0.2:
amazon-linux-extras install R4
You may need root:
sudo amazon-linux-extras install R4
I've tried setting up R 3.6.x on a docker container that uses the amazonlinux image. My approach was to get the R source file from the below link and install from source
cd /tmp/
wget https://cloud.r-project.org/src/base/R-3/R-3.6.3.tar.gz
tar -zxf R-3.6.3.tar.gz
cd /tmp/R-3.6.3
./configure --without-libtiff --without-lapack --without-ICU --disable-R-profiling --disable-nls
make
make install
you will need to yum install some dependencies, like 'make', which doesn't seem to come with aws amazonlinux docker image (which i think mirrors the EC2 instance AMI image you are referring to).
The above kind of worked for me in that i had a working R3.6 installation, but it didnt allow me use it with rshiny server, so i'm reverting to the shipped 3.4.3 version.
tl;dr: you'll probably have to manually download the source files and install the desired R version from source, and throw in some build dependencies as well.
Try this on Amazon Linux 2
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install R
Amazon Linux 2 Image contains extras library that can be used as well. Follow the guide here.
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-install-extras-library-software/
sudo amazon-linux-extras enable R3.4
sudo yum clean metadata && sudo yum install R3.4

CMake cannot find Qt5LinguistTools in Docker / Ubuntu 18.04

My simple Dockerfile:
FROM ubuntu:18.04
RUN apt update && apt upgrade -y
RUN apt install build-essential cmake qt5-default -y
RUN apt install qttools5-dev-tools -y
When I check linguist inside the container it's there:
root#9087245330a7:/# which linguist
/usr/bin/linguist
...but when I configure my app inside the container:
CMake Error at CMakeLists.txt:72 (find_package):
By not providing "FindQt5LinguistTools.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5LinguistTools", but CMake did not find one.
Could not find a package configuration file provided by "Qt5LinguistTools"
(requested version 5.5.1) with any of the following names:
Qt5LinguistToolsConfig.cmake
qt5linguisttools-config.cmake
Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
set "Qt5LinguistTools_DIR" to a directory containing one of the above
files. If "Qt5LinguistTools" provides a separate development package or
SDK, be sure it has been installed.
What is going on? This works on Ubuntu 16.04 just fine.
The problem was that in Ubuntu 18.04+ you need to install also qttools5-dev in order to get /usr/lib/x86_64-linux-gnu/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake.

How to make wkhtmltopdf work in Odoo v10 on Debian 9 "Stretch"?

I know from the Odoo website that Odoo needs an special wkhtmltopdf version:
Danger
to print PDF reports, you must install wkhtmltopdf yourself: the version of wkhtmltopdf available in debian repositories does not support headers and footers so it can not be installed automatically. The recommended version is 0.12.1 and is available on the wkhtmltopdf download page, in the archive section. As there is no official release for Debian Jessie, you can find ours on the extra section of our nightly server.
So, it is possible to install the library on Debian Jessie because there is an extraofficial version with qt patched.
If I use the wkhtmltopdf for Debian Jessie in Debian Stretch, the library is not working.
If I install wkhtmltopdf using sudo apt-get install wkhtmltopdf I get this warning when I try to print any report:
Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.No protocol specified
QXcbConnection: Could not connect to display
Is there any other way to install wkhtmltopdf for Odoo in Debian Stretch?
Is there any other available version for Odoo 10 and Debian Stretch?
Update
I have found this Git Hub issue. It seems it is not available yet
Update (2019/02/28)
I found this wiki where Odoo Developers say the version 0.12.5-1 is recommended for Odoo 10 and later
I have read this on a Git Hub Issue. The writer seems one developer of Wkhtmltopdf:
Currently working on a reworked packaging system in the wkhtmltopdf/packaging repository, you can download preview builds for linux. Will create something for 0.12.1 if required, would appreciate fixing any issues with odoo before the 0.12.5 release.
wkhtmltox_0.12.1.3-1~stretch_amd64.deb
wkhtmltox_0.12.1.3-1~stretch_i386.deb
The solution below worked:
Download libssl and libpng from debian repo and install
wget http://ftp.fr.debian.org/debian/pool/main/libp/libpng/libpng12-0_1.2.49-1+deb7u2_amd64.deb
wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u8_amd64.deb
dpkg -i libssl1.0.0_1.0.1t-1+deb8u8_amd64.deb
dpkg -i libpng12-0_1.2.49-1+deb7u2_amd64.deb
Then download wkhtmltopdf and install :
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb17
dpkg -i wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
Then add symlink:
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
It It hapened to me when I tried to use it in Ubuntu, I had to download the source and compile it, check this solution from a github issue, there is a solution by compiling the wkhtmltopdf source and eventually (if it's not doen) qt :
Source :
https://github.com/OCA/account-financial-reporting/issues/33
It's likely that you'll have to manually compile the latest version of
wkhtmltopdf and qt:
Remove wkhtmltopdf and related package
$ sudo apt-get remove libqt4-dev qt4-dev-tools wkhtmltopdf
$ sudo apt-get autoremove
Install requirement package for compiling
$ sudo apt-get install openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
Clone from git wkhtmltopdf and qt source
$ git clone git://github.com/wkhtmltopdf/wkhtmltopdf.git wkhtmltopdf
$ mkdir qt-wkhtmltopdf && cd qt-wkhtmltopdf
$ git clone https://www.github.com/wkhtmltopdf/qt --depth 1 --branch wk_4.8.7 --single-branch .
Compile qt
$ sudo ./configure -nomake tools,examples,demos,docs,translations -opensource -prefix "`pwd`" `cat ../wkhtmltopdf/static_qt_conf_base ../wkhtmltopdf/static_qt_conf_linux | sed -re '/^#/ d' | tr '\n' ' '`
$ sudo make -j3
$ sudo make install
Compile wkhtmltopdf
$ cd ../wkhtmltopdf
$ sudo ../qt-wkhtmltopdf/bin/qmake
$ sudo make -j3
$ sudo make install Reboot
$ sudo reboot

How to upgrade Atom Editor on Linux?

What is the best way to upgrade atom on Linux Ubuntu ?
I install atom using official doc
git clone https://github.com/atom/atom
cd atom
script/build
sudo script/grunt install
I created the following script to update my atom on Ubuntu 14.10.
#!/bin/bash
# Update atom from downloaded deb file
rm -f /tmp/atom.deb
curl -L https://atom.io/download/deb > /tmp/atom.deb
dpkg --install /tmp/atom.deb
echo "***** apm upgrade - to ensure we update all apm packages *****"
apm upgrade --confirm false
exit 0
The file atom_update is executable and needs to be called using su:
sudo ./atom_update
The above works, but nowadays I use the following:
sudo add-apt-repository -y ppa:webupd8team/atom
sudo apt -y update
sudo apt -y install atom
apm install \
file-icons \
tabs-to-spaces \
trailing-spaces \
xml-formatter
With the above setup
sudo apt -y upgrade
will update an installed atom to the latest version. The ppa is generally up to date.
Now, it looks like the easiest way is to download the new packaged version (.deb or .rpm) from the official releases and install it over your previous one: https://github.com/atom/atom/releases
It's now even easier with the APT package.
sudo add-apt-repository ppa:webupd8team/atom
sudo apt update
sudo apt install atom
And now you can upgrade / dist-upgrade as usual
sudo apt upgrade
Current official documentation seem to recommend another method:
Atom Github Page
Debian Linux (Ubuntu)
Atom is only available for 64-bit Linux systems.
Download atom-amd64.deb from the Atom releases page.
Run sudo dpkg --install atom-amd64.deb on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
Red Hat Linux (Fedora 21 and under, CentOS, Red Hat)
Atom is only available for 64-bit Linux systems.
Download atom.x86_64.rpm from the Atom releases page.
Run sudo yum localinstall atom.x86_64.rpm on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
Fedora 22+
Atom is only available for 64-bit Linux systems.
Download atom.x86_64.rpm from the Atom releases page.
Run sudo dnf install ./atom.x86_64.rpm on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
As of this writing, the best option to upgrade to the latest released version of Atom is to check out the most recent tag and build it, especially if you built it in the first place.
cd atom
git pull
git checkout v0.115.0 (or whatever the latest release is: https://github.com/atom/atom/releases)
script/build
sudo script/grunt install
wget https://atom.io/download/deb -O atom64.deb
sudo dpkg --install atom64.deb
or
wget https://atom.io/download/rpm -O atom64.rpm
sudo dnf install atom64.rpm
the above URLs redirect to https://atom-installer.github.com/
An easier way is to install the atom-updater-linux from the packages on the atom website.
Go to edit > preferences > install and search for atom-updater-linux
or from the terminal:
apm install atom-updater-linux
This should check for updates after every launch and prompt you to install new updates.
Currently the preferred procedure is described at the atom pages Installing Atom - Platform-linux
When using the add-apt-repository suggested in the top answer, this URL is suggested.
The apt repository mentioned at the Atom pages:
curl -sL https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'
sudo apt-get update
If you are onn Ubuntu you can go to the Ubuntu Software Center, search for Atom and just click on Update. Then job done!
If anybody is interested, I wrote a small atom package for this purpose.
The package is meant to timely inform the user of new versions being available (stable or beta, configurable via settings) and uses GitHub API under the hood. It is platform independent, so it should work with any linux distro, but also with Windows or other systems.
It does not perform the upgrade automatically as I wrote it for my needs and I was not interested in such feature. I may add it in the future should strong interest for it manifest itself, though.
Feedback is welcome, best as tickets on github.
I upgraded from
Atom : 1.26.1
Electron: 1.7.11
Chrome : 58.0.3029.110
Node : 7.9.0
to
Atom : 1.40.1
Electron: 3.1.10
Chrome : 66.0.3359.181
Node : 10.2.0
I followed these simple steps,
create a file
sudo nano /usr/local/bin/atom-update
copy following snippet and save with Ctrl+o and "enter" and Ctrl+x
your code
#!/bin/bash
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest
wget --progress=bar -q 'https://github.com'$(cat /tmp/latest | grep -o -E 'href="([^"#]+)atom-amd64.deb"' | cut -d'"' -f2 | sort | uniq) -O /tmp/atom-amd64.deb -q --show-progress
dpkg -i /tmp/atom-amd64.deb
Make it executable
sudo chmod +x /usr/local/bin/atom-update
Run the script to upgrade atom
sudo atom-update
Ubuntu 16.04 and later
Run these commands to quickly and easily install and upgrade the Atom text editor snap package from the terminal in Ubuntu 16.04 and later (64-bit only).
Install Atom text editor:
sudo snap install --classic atom
Note that a snap in classic confinement behaves as a traditionally packaged application with full access to the system, and Atom extension packages are installed into the user's home directory.
Upgrade Atom text editor:
sudo snap refresh --classic atom
I would add that you should probably clean before updating the build to prevent some nasty errors.
cd atom
git pull
script/clean
script/build
sudo script/grunt install
For debian I have created a bash script which does the following:
Check with https://api.github.com and dpkg if atom is installed and/or up-to date.
Download and install the atom.deb from github if needed.
Provide a --beta switch if somebody wants to maintain the beta version as well.
Fell free to use it, it is located here: https://gist.github.com/rumpelsepp/8a953d6c092cbeb043695cfada114bef
Since December 2017 Atom provides official repositories for all major Linux distributions. You can find the latest installation instructions here.
Latest Way is to first install $ apm install atom-updater-linux then simply press Alt+Ctrl+U or go to Help and there is option for check for updates

Resources