Keras (Theano backend + GPU + CUDA) not working with PyDev - gpu

I am using Keras (Theano backend) with GPU and Cuda 8.0. Everything works fine when I run my code in Jupyter or Ubuntu terminal. However, inside Eclipse (PyDev) I receive the following error importing Keras:
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: libcublas.so.8.0: cannot open shared object file: No such file or directory
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu0 is not available (error: cuda unavailable)
I have double checked the interpreter and it is the same python as the terminal and Jupyter. I have also added the /usr/local/cuda/lib64/ to the pythonpath of the interpreter but still the same error !
Anybody knows how to fix the issue with PyDev?
Thank you,

I found a solution but not the reason.
I started Eclipse from Ubuntu terminal and it worked fine. I don't know why it couldn't find CUDA path when I start it by double clicking on its icon.

Related

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.

Deep Reinforcement Learning Hands on, chapter 7. Can't get tensorflow to work

Doing a course in Machine Learning and can't get Tensorboard to work. I have saved runs from running a DQN and I write:
tensorboard -logdir runs
With the folliwng result:
2019-12-28 18:32:04.265065: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
TensorBoard 1.7.0 at http://david-linux:6006 (Press CTRL+C to quit)
So I click the link and get:
No dashboards are active for the current data set.
Probable causes:
You haven’t written any data to your event files
TensorBoard can’t find your event files.
I also get this result after having the code running for a while:
"W1228 18:34:34.186506 Thread-2 application.py:272] path /[[_dataImageSrc]] not found, sending 404
W1228 18:34:34.205581 Thread-2 application.py:272] path /[[_imageURL]] not found, sending 404"
Running this on Linux using Anaconda Python version 3.6 because that is what the course book uses. Have no idea what the above errors means, quite new to coding in general and reinforment learning in particular.
It could be caused if the browser isn't updated. You could also try installing the latest version of Tensorboard:
pip uninstall tensorflow-tensorboard
pip install tensorboard
Also try using different browsers.
Can you just try going to http://localhost:6006 instead? It looks like your hostname is not one that actually resolves in DNS.

Tensorflow not working on Python 3.7, Mac OS, and Pycharm

Attempting to run tensorflow a Mac, using python 3.7 as well as PyCharm and receiving where module tensorflow has no attribute app, at the following.
I've run through a number of potential solutions. Following the instructions provided on this question: Installing tensorflow on Pycharm (Mac). I've managed to successfully create a virtual-env in which I installed the tensorflow package however this folder contains
nothing but the init.py and pycache and the error remains.
I've also tried copying the contents of the tensorflow GitHub repo directly into this folder but it results in an ImportError.
Not sure what the issue is. Should I switch to python 2.7?
Python 3.7 is still unsupported as of this moment by tensorflow.

Tensorflow on Anaconda error cannot find cudnn64_6.dll

I am having a problem with Tensorflow running on Spyder. When I installed it in cmd, it had the same problem that it couldn't find the path to cudnn64_6.dll, and so I added pathway to it and it seemed to import. Then, I installed the theano library and the keras and it seemed ok, then when I tried to import the keras library in spider, I got this message:
I have Cuda v8.0 and it should have that with it, at least I am told. I have installed all the drivers and downloaded the cudnn v6.0 for Cuda 8.0 and have added enough paths but still no luck. Where have I gone wrong?
Its Ok I just had to get rid of some environment paths and restart. My bad

Getting errors installing Tensorflow GPU

I was earlier working with the CPU only version of tensorflow. I tried installing the GPU version now using this link.
But I think I messed up.
When I try to do import tensorflow it gives the following message:
ImportError: libcudart.so.7.5: cannot open shared object file: No such file or directory
What should I do?
It could be because a wrong version of cuda is installed : check /usr/local/ for the versions of cuda that are installed and if it matches with the version in the Tensorflow error. If it both versions don't match, you'll have to either install another version of cuda or Tensorflow.
Another reason could be because of missing environment variables (as explained here).
Try this :
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda