我在Windows 7 64位上运行Anaconda 4.3.1(Python 3.6.1)并且无法将theano和openturns导入到我的会话中,但是只导入一个或其他工作正常。显然,一方在另一方引起某种导入冲突,但我不了解导入过程以确定原因。
如果theano被导入并且我尝试导入openturns,我得到了这个:
import theano.tensor as tt
import openturns as ot
Traceback (most recent call last):
File "<ipython-input-38-704e69d30dff>", line 1, in <module>
import openturns as ot
File "C:\Anaconda3\lib\site-packages\openturns\__init__.py", line 61, in <module>
from .common import *
File "C:\Anaconda3\lib\site-packages\openturns\common.py", line 20, in <module>
_common = swig_import_helper()
File "C:\Anaconda3\lib\site-packages\openturns\common.py", line 19, in swig_import_helper
return importlib.import_module('_common')
File "C:\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_common'
如果我尝试反过来,导入openturns然后我尝试导入theano,我明白了:
import openturns as ot
from theano import tensor as tt
Traceback (most recent call last):
File "<ipython-input-3-ed4283f52c57>", line 1, in <module>
from theano import tensor as tt
File "C:\Anaconda3\lib\site-packages\theano\__init__.py", line 80, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "C:\Anaconda3\lib\site-packages\theano\scan_module\__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "C:\Anaconda3\lib\site-packages\theano\scan_module\scan_opt.py", line 60, in <module>
from theano import tensor, scalar
File "C:\Anaconda3\lib\site-packages\theano\tensor\__init__.py", line 9, in <module>
from theano.tensor.subtensor import *
File "C:\Anaconda3\lib\site-packages\theano\tensor\subtensor.py", line 26, in <module>
import theano.gof.cutils # needed to import cutils_ext
File "C:\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 320, in <module>
compile_cutils()
File "C:\Anaconda3\lib\site-packages\theano\gof\cutils.py", line 285, in compile_cutils
preargs=args)
File "C:\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2325, in compile_str
return dlimport(lib_filename)
File "C:\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 302, in dlimport
rval = __import__(module_name, {}, {}, [module_name])
ImportError: DLL load failed: The specified procedure could not be found.
不确定是否相关,但Theano安装要求我将包含一些DLL的文件夹添加到系统PATH。谢谢!
答案 0 :(得分:1)
似乎来自默认的anaconda频道的theano软件包提取了mingw依赖项,这可能与我们自己的新提供的运行时冲突;解决方法是从conda-forge安装所有内容。
这应该有效:
conda install openturns theano pymc3 -c conda-forge