install tensorflow from source code, cuda9.1, cuDNN7.0.5, libcublas.so.9.1 not found - tensorflow

ERROR: /home/kenny/Downloads/tensorflow-1.5.0-rc1/tensorflow/contrib/lite/toco/BUILD:326:1: Linking of rule '//tensorflow/contrib/lite/toco:toco' failed (Exit 1)
/usr/bin/ld: warning: libcublas.so.9.1, needed by bazel-out/k8-py3-opt/bin/_solib_local/_U_S_Stensorflow_Scontrib_Slite_Stoco_Ctoco___Utensorflow/libtensorflow_framework.so, not found (try using -rpath or -rpath-link)

Check this issue comment
https://github.com/tensorflow/tensorflow/issues/15656#issuecomment-362104182
The current version of TensorFlow (1.7) does not support CUDA9.1, but you should have several options:
Downgrade to CUDA 9.0
Compile TensorFlow from the source code by your own
Find an existing whl file for you (unofficial release). ex. I fixed the issue by using a whl from https://github.com/mind/wheels
Wait until Tensorflow supports CUDA9.1 :)

Looks like you need to install Cuda 9.1 from Nvidia as a prerequisite to building from source.

I also had similar issue. Probably adding this flag --action_env="LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" in your bazel build command will solve the issue. Make sure you have set the environment variable LD_LIBRARY_PATH as /usr/local/cuda/lib64 or wherever your cuda toolkit installation is present.
EDIT: In case setting up environment variable doesn't work. You can further try by running sudo ldconfig -v|grep 'libcublas.so.9.1'. In my case cuda's version is 9.1 hence I verify for the same. If grep doesn't return the expected library, just try other ways to register your path to ldconfig

It's a weird dynamic link lib error.
Somehow bazel doesn't recognize LD_CONFIG. You'll have to manually update the /etc/ld.so.conf (in my case with Ubuntu 17.1, the config files are in /etc/ld.so.conf.d), and add a line that points to the /usr/local/cuda/lib64 folder.
Then run
sudo ldconfig
to re-build the ld cache. You can verify that the cuda libs are in the search folders by
sudo ldconfig -v | grep cuda
The build should work now.

Related

include could not fined load file: CGAL_TBB_support

I'm trying to run "Triangulation_3" examples and while doing the "cmake" I get this error:
CMake Error at CMakeLists.txt:44 (include):
include could not find load file:
CGAL_TBB_support
I'm using ubuntu 20.04 and I've already installed TBB library using
sudo apt-get install libtbb-dev
How can I fix this error?
Thanks.
It seems you are using the system libcgal-dev version 5.0.3, as provided by apt for Ubuntu 20.04. That version of CGAL does not have the CMake module CGAL_TBB_support.cmake.
Probably you are using CGAL examples from more recent version of CGAL, maybe one you downloaded or cloned using Git.
If you recent version of CGAL is, for example, at the path /home/me/downloads/CGAL-5.3, then set the CMake cache variable CGAL_DIR to that directory. You can pass the option -DCGAL_DIR=/home/me/downloads/CGAL-5.3 to the cmake command line, for example. Or set the variable CGAL_DIR to /home/me/downloads/CGAL-5.3 in CMake-GUI. Of course, adjust you the real path on your system.

Msys2 in windows 10 with GTK return error pkg-config

hi guys i try to run Msys2 and GTK in windows 10 i follow this installation
https://www.gtk.org/docs/installations/windows
when i'am arrived at step 5 ,pacman -S mingw-w64-x86_64-toolchain base-devel , i install all packet
i tested installation , but return me:
gcc -o main.c -pthread pkg-config --cflags --libs gtk+-3.0
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
bash: gcc: command not found
i add in my windows envairoment variable in the system this path
PKG_CONFIG_PATH
C:\msys64\mingw64\lib\pkgconfig
and i insert in all my .bashrc
this code export PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
but nothing return me always the same error
anyone can help me ? or have some suggestions , thanks
The instructions you linked to say to install the mingw-w64-x86_64-gtk3 package. That is a package for the 64-bit MinGW environment provided by MSYS2. Therefore, to use it, you must start MSYS2 by running mingw64.exe from the MSYS2 installation directory, or using the corresopnding shortcut in your start menu. You can type echo $MSYSTEM and if it returns MINGW64 then you are using the right environemnt. You should not need to edit PKG_CONFIG_PATH yourself in your .bashrc.
In case this might help you or somebody else: I've had the same problem happen in a build using MSYS2 - not for GTK3 but for a bunch of different libraries. The PKG_CONFIG_PATH was definitely exported correctly and its path was also correct but pkg-config would stubbornly search in its default search paths instead of the ones provided outside of the MSYS2 install. I tried exporting the variable and setting it through the .bashrc file but that got me nowhere.
I'm not fully sure why it works but, reading through some old company internal docs, I read that installing the dos2unix utility automagically fixed the problem and it did work for me. Install it using pacman -S dos2unix. You might want to update your package list first with pacman -Syu to have up to date packages.

configure: error: Qtenv cannot find qmake in omnet++ installation

I'm trying to install omnetpp 5.2.1 on windows 10. But getting an error while doing ./configure command related to QT environment. I tried changing the configure.user file in omnetpp package to change the path of QT but still its not working. Here is the error:
configure:error: Qtenv cannot find qmake--maybe it is not in the path
or has some exotic name (tested names were: qmake qmake-qt5 qmake5)-
disabling Qtenv. You can try setting QT_PATH variable in
configure.user to a valid location.
qt5 might not be installed.
sudo apt install qt5-default worked for me while installing on Ubuntu 20.04.
OMNeT++ comes with all dependencies bundled. As long as you have executed the mingwenv.cmd and running from that shell, qmake should be available in the path (in tools/win64/mingw64/bin). Check if qmake.exe is present there. If not, make sure that ZIP file you have downloaded is intact. Standard windows unzip may fail on certain systems...
run ./configure WITH_QTENV = no

cuda install error on Ubuntu 17.04

abigail#abilina:~/Downloads$ sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
Selecting previously unselected package cuda-repo-ubuntu1604.
(Reading database ... 205999 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_8.0.61-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1604 (8.0.61-1) ...
Setting up cuda-repo-ubuntu1604 (8.0.61-1) ...
Warning: The postinst maintainerscript of the package cuda-repo-ubuntu1604
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package cuda-repo-ubuntu1604)
OK
abigail#abilina:~/Downloads$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
cuda : Depends: cuda-8-0 (>= 8.0.61) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
My ubuntu version is 17.04. Does this mean my Linux currently can't install CUDA? I want to install TensorFlow with GPU support.
Per suggestion:
abigail#abilina:~/Downloads$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
https://launchpad.net/ubuntu/zesty/amd64/nvidia-cuda-toolkit
above is the correct one.
apt-get install nvidia-cuda-toolkit
but remember the cuda installed through apt were installed in different location. manually create ln -s at /usr/local/cuda for include,lib64,and bin
I have successfully installed CUDA 8.0 + the latest patch from NVIDIA on Ubuntu 17.04:
Download the .run file from https://developer.nvidia.com/cuda-downloads, choosing Ubuntu 16.04 (Base Installer)
You will not be able to install it by just running, because it is looking for a file called InstallUtils.pm which is not present in Ubuntu 17.04, but curiously, is present in the .run file - so: unpack the .run file using ./cuda*.run --tar mxvf
copy InstallUtils.pm (should be in the /bin path) to /usr/lib/x86_64-linux-gnu/perl-base
Run the installer (You may want to say no to the driver install step to keep the one you install through apt - I'm using 381.22, because 375.26, which is provided by the .run file does not support my 1080ti)
gcc 6 is incompatible with CUDA, but this is easily remedied for compiling the sample files: just add export EXTRA_NVCCFLAGS="-Xcompiler -std=c++98" to your bashrc file, and comment out
from one of the headers (I think it was host_config.h, but you'll see it once you try to compile) - comment out these lines:
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 3)
#error -- unsupported GNU version! gcc versions later than 5.3 are not supported!
This is all from memory, so hopefully it's accurate enough.
I managed to find this solution thanks to these useful posts:
https://devtalk.nvidia.com/default/topic/983777/can-t-locate-installutils-pm-in-inc/
https://devtalk.nvidia.com/default/topic/949770/cuda-8-0rc-supporting-gcc6-/
For ubuntu 17.04, I had to use cuda 9.0 (deb version)
https://developer.nvidia.com/cuda-release-candidate-download
I couldn't get it to work otherwise. Cuda 8.0 needs gcc 5.3.1 but cuda 9.0 is compatible with gcc 6.3.0 which is installed on ubuntu 17.04 automatically.
More precisely, this is what I did:
On Ubuntu 17.04, install CUDA 9.0 — you can currently download the beta version 
https://developer.nvidia.com/cuda-release-candidate-download
I downloaded the .deb file and haven’t had any problems — follow the steps they recommend when you download cuda 9.0 
sudo dpkg -i cuda-repo-ubuntu1704-9-0-local-rc_9.0.103-1_amd64.deb
sudo apt-key add /var/cuda-repo-9.0-local-rc/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
Then follow the post installation steps from the nvidia instructions (i.e., setting PATH and LD_LIBRARY_PATH) 
 http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions)
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Cuda 9 is compatible with gcc 6.3.0 (which comes with 17.04). I used arch=sm_52 and sometimes for my make files have to go ‘make clean’.
Installing Cuda 9.0 was the simplest solution in my case.
Alternatively, if you'd prefer cuda 8, you can download the deb file and then use the command
dpkg-deb -x cuda_8.*.deb /usr/local/cuda-8.0
to extract the contents from the deb file and have them placed in the desired directory.
Source: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#advanced-setup)

Tensorflow with gpu support installation error - the specified --crosstool_top is not a valid cc_toolchain_suite rule

I've been trying to install tensorflow with GPU support using these steps:
http://www.nvidia.com/object/gpu-accelerated-applications-tensorflow-installation.html
and also using:
http://thelazylog.com/install-tensorflow-with-gpu-support-on-sandbox-redhat/
This is the error message that I'm getting when I try to run the bazel build command for building the tensorflow pip package (with the --config-cuda flag set):
The specified --crosstool_top '//third_party/gpus/crosstool:crosstool' is not a valid cc_toolchain_suite rule.
What's strange is that if i remove the --config=cuda flag, I don't get the error message while building and I'm able to install tensorflow successfully - but without GPU support.
I experienced the same issue, using the nvidia instructions. What I did was to drop the git reset line in the instructions, and it works.
Details (from the error message):
Close, reopen terminal
Run git clone (again), and cd tensorflow
Run ./configure
Bazel build, etc
This may be unrelated, but I experienced an issue with the .whl line, the error message was that the wheel cannot be found or something along those lines. This is the "And finally install the TensorFlow pip package" section. To resolve it in my case, I typed in the terminal all the way to "..._pkg/tensorflow", and then pressed tab for auto-completion. The file name that popped up was significantly longer than that in the guide, but it worked. Also, if anyone face a numpy not installed message based on the nvidia instructions, replace the python-pip and dev with python-numpy and run that line again to install.
Configuration: Fresh Ubuntu 16.04, GTX970M, running driver 367.48 (from CUDA installation), CUDA 8.0, CuDNN 5.1
Full setup path:
Fresh Ubuntu, with downloads and 3rd party apps selected during installation.
Control panel => Software and updates => Other Software => Canonical ticked
Install CUDA using nvidia instructions in CUDA documentation, .deb format
CuDNN 5.1 installed, the rest from the nvidia link.
I hope everything works out for you!
(I'm sorry for the poor formatting)
I was going through same problem and recently found the solution. The problem is with the installation of Bazel which leads to this kind of error.
After installation of bazel from installer, make sure that you would give the correct path to ~./bashrc and also activate the path using
source "path-to-your-bin-directory-for-bazel"
Please change the git source version slightly as shown below
$ git clone https://github.com/tensorflow/tensorflow
$ cd tensorflow
// $ git reset --hard 70de76e
$ git reset --hard 287db3a
And please refer the below l
https://github.com/tensorflow/tensorflow/issues/4944
Also, zlib has been updated since this TF build. You need to check http://www.zlib.net/ to get the latest version and SHA-256, then update tensorflow/workspace.bzl with that information (lines 254-266 in this build). At this time, the correct version info would include the following:
url = "http://zlib.net/zlib-1.2.11.tar.gz",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",