5

I am trying to import theano in a module, but I am getting a traceback:

File "/media/tarun/6A86CA8286CA4DEF/develop/pydy/pydy/codegen/code.py", line 16, in <module>
import theano
File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 44, in <module>
from theano.gof import \
File "/usr/local/lib/python2.7/dist-packages/theano/gof/__init__.py", line 38, in <module>
from theano.gof.cc import \
File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 55, in <module>
StrParam(""))
File "/usr/local/lib/python2.7/dist-packages/theano/configparser.py", line 223, in AddConfigVar
  root=newroot, in_c_key=in_c_key)
File "/usr/local/lib/python2.7/dist-packages/theano/configparser.py", line 227, in AddConfigVar
configparam.fullname)
AttributeError: ('This name is already taken', 'gcc.cxxflags')

It seems that there is some name conflict in some config. Can anybody please point me to the same.

Tarun Gaba
  • 1,103
  • 1
  • 8
  • 16

2 Answers2

2

This error happens because some module, probably theano.gof, is imported twice. Usually, this is because a first call to import theano.gof gets started, registering 'gcc.cxxflags' in the configuration parser a first time, but then raises ImportError, which is catched and ignored. Then, import theano.gof gets called again, tries to register the option again, which raises the exception you get.

Is there any traceback or error message before this one, or something that would give a hint of why the first import failed?

Pascal Lamblin
  • 356
  • 1
  • 3
0

I got similar error using when using the jupyter notebook. Restarting kernel solved the issue.

RM-
  • 986
  • 1
  • 13
  • 30