I am trying to install CUDA8-Theano-Keras according to these instructions.

When I get to the bullet-point 13 (python3 check1.py), which is supposed to check that Theano was setup with GPU, it breaks on me with the following message:

Traceback (most recent call last):
  File "check1.py", line 1, in <module>
    from theano import function, config, shared, sandbox
  File "/home/marija/anaconda3/lib/python3.6/site-packages/theano/__init__.py", line 45, in <module>
    from theano.configdefaults import config
  File "/home/marija/anaconda3/lib/python3.6/site-packages/theano/configdefaults.py", line 17, in <module>
    from theano.configparser import (AddConfigVar, BoolParam, ConfigParam, EnumStr,
  File "/home/marija/anaconda3/lib/python3.6/site-packages/theano/configparser.py", line 86, in <module>
  File "/home/marija/anaconda3/lib/python3.6/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/home/marija/anaconda3/lib/python3.6/configparser.py", line 1077, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/home/marija/.theanorc', line: 1

Any ideas what is the issue here?

1 Answer 1


On 12. Configure theano to use GPU by default it asks to copy some string with quotation marks. Unfortunately, if you take a closer look, that webpage displays some fancy quotation marks, which are not recognised by terminal as ones. Compare "something" and “something”. Executing this command you simply added these and changed the meaning (look at the last line of your Traceback -> ' “ .... “ ' ).

What you want instead is this line (or paste from that site, but correct quotetions):

echo -e "\n[global]\nfloatX=float32\ndevice=gpu\n[mode]=FAST_RUN\n\n[nvcc]\nfastmath=True\n\n[cuda]\nroot=/usr/local/cuda" >> ~/.theanorc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.