当前位置: 动力学知识库 > 问答 > 编程问答 >

python - Name conflicting in Theano

问题描述:

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.

网友答案:

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?

网友答案:

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

分享给朋友:
您可能感兴趣的文章:
随机阅读: