Install openCV with CUDA toolkit 8.0 - opencv

I'm trying to install Opencv 3.2.0 and Nvidia CUDA toolkit 8.0 on Ubuntu 16.04 but I can't configure them together. I get the following error when I try to make project using both:
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find CUDA: Found unsuitable version "8.0", but required is exact
version "7.5" (found /usr/local/cuda)
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:386 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.5/Modules/FindCUDA.cmake:949 (find_package_handle_standard_args)
/usr/local/share/OpenCV/OpenCVConfig.cmake:86 (find_package)
/usr/local/share/OpenCV/OpenCVConfig.cmake:105 (find_host_package)
CMakeLists.txt:10 (find_package)
-- Configuring incomplete, errors occurred!
I have tried installing cuda toolkit 7.5 but its not compatible with ubuntu 16.04 I believe. I'm really clueless now, I hope someone can help with this.
Thanks

so I solved this issue by managing to install toolkit 7.5. Here is how I did it:
Updated nvidia driver for my Operating System
Download cuda toolkit 7.5 and extract it to a folder
$ mkdir ~/Downloads/NVIDIA_TOOLKIT
$ cd ~/Downloads
$ ./cuda_7.5.18_linux.run -extract=~/Downloads/NVIDIA_TOOLKIT;
go to the virtual console by pressing Ctrl + Alt + F1 and turn off
lightdm service
$ sudo service lightdm stop
cd to downloads and install the extracted toolkit and samples
$ cd ~/Downloads/NVIDIA_TOOLKIT
$ sudo ./cuda-linux64-rel-6.0.37-18176142.run
$ sudo ./cuda-samples-linux-6.0.37-18176142.run
Set environment variables in .bashrc file
$ PATH=/usr/local/cuda-7.5/bin
$ LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64
Turn back on the lightdm service
$ sudo service lightdm start
Reboot and you should be able to use the nvcc compiler
For openCV you will have to downgrade your gcc/ g++ compiler to 4.9 since it is not yet compatible with the higher versions

Related

Pydrake has issue with python 3 point 9

Is Python3.9 supported?
I got this error with Python3.9:
File "/home/drake/drake/drake-build/install/lib/python3.6/site-packages/pydrake/common/__init__.py", line 8, in <module> from ._module_py import * ModuleNotFoundError: No module named 'pydrake.common._module_py'
There is no "python3.9" folder in .../install/lib.
I am running Ubuntu 18, and I am building Drake from source with latest github commit in master.
EDIT: Can someone explain how exactly Drake sets up pydrake?
It seems it detects the default Python installation somewhere automatically. I tried with a new installation, the default python was 3.8, and I also install:
apt install -y python3.10
Then I followed Drake python setup instructions.
git clone https://github.com/RobotLocomotion/drake.git
mkdir drake-build
cd drake-build
cmake ../drake
make -j
Pydrake only became available in 3.8. How to make it available for 3.10?
The current version of Pydrake (1.11.0) is officially supported on Ubuntu 20.04 with Python 3.8 and Ubuntu 22.04 with Python 3.10 when building from source. However, we recommend that most users use a binary release, and don't try to rebuild Drake from scratch themselves.
There are precompiled wheels at https://pypi.org/project/drake/ aka pip install drake; helpful installation details are at https://drake.mit.edu/pip.html. The wheels when run on Ubuntu support Python versions 3.8, 3.9, 3.10, or 3.11.
For example:
python3 -m venv env
env/bin/pip install --upgrade pip
env/bin/pip install drake
source env/bin/activate
For additional details, see https://drake.mit.edu/installation.html for full instructions and supported versions.
The last version of Pydrake to support Ubuntu 18.04 was v1.1.0 (released in March of 2022). If you need a newer version of Pydrake, you'll need to use a newer version of Ubuntu.

How to setup ROS environment variable on Ubuntu 20.04?

I tried following this guide to install ROS, but even after adding ROS source.list and its key
sudo apt install ros-melodic-desktop-full
gave error.
E: Unable to locate package ros-melodic-desktop-full
Then I ran this command
sudo apt search ros
to see if any such package exists. I couldn't find ros-melodic-desktop-full but I found another similar package ros-desktop-full.
So I installed it instead. The installation went smooth without giving any errors.
Next step in the guide is to set-up ROS environment variable, but I have no such directory
/opt/ros
So how do I setup the environment variable?
P.S.
I also installed some tools and dependencies with this command
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
and initialized rosdep
sudo rosdep init
rosdep update
The ros-desktop-full package you installed is part of the official Ubuntu release.
ROS Melodic (and in the future, Noetic) is published by the OSRF in a separate repository (packages.ros.org). These packages install to /opt/ros/. However, some ROS packages have also been ported to Debian, which is how they found their way to Ubuntu (which derives from Debian).
The Debian packages are fully functional, but they do not install to /opt/ros. Instead, everything is integrated in the operating system itself. This means that you need to set up your personal workspace slightly differently.
Given that most tutorials assume that you use the OSRF packages, I suggest you either wait for the Noetic release (scheduled for the end of May 2020), then install ros-noetic-desktop-full, or downgrade to Ubuntu 18.04 LTS to use ROS Melodic.
From the documentation here, melodic is only supported on Ubuntu 18.04. The ROS version targeting Focal (20.04) is Noetic, but that one has not been released yet (see Distributions). I'm not sure what ROS version Ubuntu packages (the ros-desktop-full one you installed), but I was not successful in using it.
If you really do want to use Ubuntu 20.04, then I think your best option currently is to compile from source. Last time I checked the precompiled debs for Noetic are not yet available at http://packages.ros.org/ros/ubuntu (you can track release progress at github issue 21513). No idea if compiling Noetic from source is easy or hard, but I was able to compile ROS2 foxy from source without too much trouble though.

Nvidia-smi command not found - nvidia drivers installed

~$ nvidia-smi
nvidia-smi: command not found
~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Tue_Jun_12_23:07:04_CDT_2018
Cuda compilation tools, release 9.2, V9.2.148
Its worked before. I made changes in grub using the command
gksu gedit /etc/default/grub
but revert it back. (I don't know if it could have effect)
Reason
The most common reason for any “command not found” error is that the software being accessed is not installed on the system. Check out the example below where the tool is not installed on the system and the error “nvidia-smi command not found” is thrown:
Solution
The best way of resolving this error is to install the “nvidia-utils” package which will also contain the “nvidia-smi” tool inside it. To install this package, run the command in the terminal:
$ sudo apt install nvidia-utils-515
I got the detailed solution form this post: https://itslinuxfoss.com/fix-nvidia-smi-command-not-found-error/

opencvlibrary 2.4 installation [duplicate]

I installed open cv in my ubuntu 11.04. But whenever I try to run any code I get the following error:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /home/robik/Downloads/Java/OpenCV-2.3.1/modules/highgui/src/window.cpp, line 275
terminate called after throwing an instance of 'cv::Exception'
what(): /home/robik/Downloads/Java/OpenCV-2.3.1/modules/highgui/src/window.cpp:275: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow
I already have libgtk2.0-dev and pkg-config in my OS. What should I do?
re configure and then re-run cmake. checkout this tutorial

Can not find CUDA_NPP_LIBRARY_ROOT_DIR in cmake

I am trying to install opencv 2.2 with cuda enabled. I have installed CUDA and also have compiled and tested some programs with it.
Now I want to install opencv with gpu. I downloaded cmake-gui and set CUDA on. When I hit the configure button it does find cuda toolkit but gives me this error:
CMake Error at modules/gpu/FindNPP.cmake:102 (message):
NPP headers/libraries are not found. Please specify
CUDA_NPP_LIBRARY_ROOT_DIR in CMake or set $NPP_ROOT_DIR.
Call Stack (most recent call first):
modules/gpu/CMakeLists.txt:38 (find_package)
I have installed everything in the default directory.
My cuda-toolkit version is 4.0. Also I have opencv 2.2 without gpu installed.
And in case it might help:
My OS is ubuntu 11.04, my gpu is geforce gtx550, and my cuda driver version is 280.13

Resources