Comments (19)
I've already solved it.You should change "gpu0" to "cuda0"
from deep-learning-keras-tensorflow.
Ok I think I should probably improve the part in which I explain how to properly setup theano
:
Since version 0.9
they finally introduced the libgpuarray
which was previously only available in the development version.
These are the two options I came up with to properly install and configure theano
on (ubuntu) Linux with GPU support:
- [If you're using Anaconda]
conda install theano pygpu
should be just fine!
Sometimes it is suggested to install pygpu
using the conda-forge
channel:
conda install -c conda-forge pygpu
- [Works with both Anaconda Python or Official CPython]
-
Install
libgpuarray
from source: Step-by-step install libgpuarray user library -
Afterwards, installing
pygpu
from source: (in the same folder)
python setup.py build && python setup.py install
-
pip install theano
.
After Theano is installed:
echo "[global]
device = cuda
floatX = float32
[lib]
cnmem = 1.0" > ~/.theanorc
HTH
from deep-learning-keras-tensorflow.
Hi @akYoung.
According to Theano documentation, the cpu
value should be valid: http://deeplearning.net/software/theano/library/config.html#config.device
I think that the problem may be related to the device=cpu
and other settings reported.
For instance, the nvcc
section only relates to the cuda
code and GPUs.
Could you please share the exact error you get?
Which operating system?
Thanks,
Valerio
from deep-learning-keras-tensorflow.
The system is Ubuntu 16.04 64bit system.
The $HOME/.theanorc
is configured as following.
[global]
floatX = float32
device = cpu # switch to cpu if no GPU is available on your machine
And when I import keras
It shows the following error,
Using Theano backend.
Traceback (most recent call last):
File "", line 1, in
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/keras/init.py", line 2, in
from . import backend
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/keras/backend/init.py", line 58, in
from .theano_backend import *
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/keras/backend/theano_backend.py", line 1, in
import theano
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/theano/init.py", line 42, in
from theano.configdefaults import config
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/theano/configdefaults.py", line 109, in
in_c_key=False)
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/theano/configparser.py", line 276, in AddConfigVar
configparam.get(root, type(root), delete_key=True)
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/theano/configparser.py", line 324, in get
self.set(cls, val_str)
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/theano/configparser.py", line 335, in set
self.val = self.filter(val)
File "/home/akyang/anaconda3/envs/deep-learning/lib/python3.5/site-packages/theano/configdefaults.py", line 95, in filter
% (self.default, val, self.fullname)))
ValueError: Invalid value ("cpu") for configuration variable "cpu # switch to cpu if no GPU is available on your machine". Valid options start with one of "device", "gpu", "opencl", "cuda"
'
from deep-learning-keras-tensorflow.
I get essentially the same error on my Mac, when I set "device = cpu" , as shown....
>>> import numpy as np
>>> import scipy as sp
>>> import pandas as pd
>>> import matplotlib.pyplot as plt
>>> import sklearn
>>> import keras
Using Theano backend.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/shawley/anaconda/lib/python3.5/site-packages/keras/__init__.py", line 2, in <module>
from . import backend
File "/Users/shawley/anaconda/lib/python3.5/site-packages/keras/backend/__init__.py", line 58, in <module>
from .theano_backend import *
File "/Users/shawley/anaconda/lib/python3.5/site-packages/keras/backend/theano_backend.py", line 1, in <module>
import theano
File "/Users/shawley/anaconda/lib/python3.5/site-packages/theano/__init__.py", line 42, in <module>
from theano.configdefaults import config
File "/Users/shawley/anaconda/lib/python3.5/site-packages/theano/configdefaults.py", line 109, in <module>
in_c_key=False)
File "/Users/shawley/anaconda/lib/python3.5/site-packages/theano/configparser.py", line 276, in AddConfigVar
configparam.__get__(root, type(root), delete_key=True)
File "/Users/shawley/anaconda/lib/python3.5/site-packages/theano/configparser.py", line 324, in __get__
self.__set__(cls, val_str)
File "/Users/shawley/anaconda/lib/python3.5/site-packages/theano/configparser.py", line 335, in __set__
self.val = self.filter(val)
File "/Users/shawley/anaconda/lib/python3.5/site-packages/theano/configdefaults.py", line 95, in filter
% (self.default, val, self.fullname)))
ValueError: Invalid value ("cpu") for configuration variable "cpu # switch to cpu if no GPU is available on your machine". Valid options start with one of "device", "gpu", "opencl", "cuda"
If one leaves it as "gpu", then a different error results:
AttributeError: ('This name is already taken', 'floatX').
If one comments out the line in .theanorc with floatX in it, then the same error about floatX being already taken still occurs.
Fix: commenting out the line with "device" on it has resulted in a working keras installation. i.e.:
% cat ~/.theanorc
[global]
floatX = float32
#device = cpu # switch to cpu if no GPU is available on your machine
[nvcc]
fastmath = True
[lib]
cnmem=.90
>>> import keras
Using Theano backend.
>>>
from deep-learning-keras-tensorflow.
I have exactly the same error but no solution worked for me. Please advice
Invalid value ("cpu") for configuration variable "gpu". Valid options start with one of "device", "opencl", "cuda"
from deep-learning-keras-tensorflow.
Same problem for me
from deep-learning-keras-tensorflow.
same problem for me.Is there any idea?
from deep-learning-keras-tensorflow.
Try removing ~/.theanorc.
from deep-learning-keras-tensorflow.
@akYoung how to remove that file? It's configuration file.
from deep-learning-keras-tensorflow.
I solved my problem by installing the new backend.
from deep-learning-keras-tensorflow.
I insalled the new backend but it does not work for me...
Same error:
"ValueError: Invalid value (“cpu”) for configuration variable “gpu”. Valid options start with one of “device”, “opencl”, “cuda”"
Can you help me, please?
from deep-learning-keras-tensorflow.
@Hazarapet It's been a long time and I am a little fuzzy about it. I suppose I just ran 'rm -rf ~/.theanorc' and it just worked. Maybe you can back it up and try removing it.
from deep-learning-keras-tensorflow.
@Hazarapet ok.
from deep-learning-keras-tensorflow.
@Hazarapet Error is chnged now
"ERROR (theano.gpuarray): pygpu was configured but could not be imported or is too old (version 0.6 or higher required)
NoneType: None
Traceback (most recent call last):
File "Desktop\TheanoCode\firstTest.py", line 9, in
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
NameError: name 'shared' is not defined"
It seems to depend on the Theano beckend that I modified!
It's so instable!!!
from deep-learning-keras-tensorflow.
I forgot to say that you have to install "gpuarray"
http://deeplearning.net/software/libgpuarray/installation.html
from deep-learning-keras-tensorflow.
I changed python version and now theano works!
I have installed python 2.7 by Anaconda and then theano by conda with pygpu.
At this moment the test seems to go :-)
Thanks a lot!
from deep-learning-keras-tensorflow.
@Primula it works with Python 3 as well. This is just to point out that it is not a matter of Python version ;)
from deep-learning-keras-tensorflow.
Are you italian? Your name suggests me that's true.
I think I'll try Anaconda3 asap, but when I installed Theano by Anaconda2 it worked immediatly.
I have Win 10, and in some Microsoft developer forum I find this option.
Finally, I'm Italian so if my impression is real, we may interact more clearly.
from deep-learning-keras-tensorflow.
Related Issues (17)
- typo in environment creation HOT 2
- Image inpainting using vgg19 HOT 4
- setup error with pydatait branch HOT 1
- Inline images don't show up HOT 2
- Couldn't build conda env HOT 5
- Import matplotlib RuntimeError HOT 1
- Fine tuning VGG16
- Deep Learning for Edge detection HOT 1
- typo in readme
- Theano does not recognise this flag:
- what is sentence_matrix
- Whether the model can include the Embedding layer?
- is video available pls?
- Configuration issues with keras import HOT 2
- sequence classification using LSTM
- Why is the 'change' to the weights impacted by the last activation? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deep-learning-keras-tensorflow.