Aorus
Aorus

Reputation: 138

Python package import conflicts (Theano and openturns)

I'm running Anaconda 4.3.1 (Python 3.6.1) on Windows 7 64-bit and am unable to import both theano and openturns into my session, however importing only one or the other works fine. Obviously one is causing some sort of import conflict in the other, but I don't understand enough of the importing process to identify why.

If theano is imported and I attempt to import openturns, I get this:

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'

If I attempt the converse, where openturns is imported and I then attempt to import theano, I get this:

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.

Not sure if relevant, but the Theano installation required that I add a folder containing some DLLs to the system PATH. Thanks!

Upvotes: 1

Views: 619

Answers (1)

jschueller
jschueller

Reputation: 41

It seems the theano package from the defaults anaconda channel pulls mingw dependencies, which probably conflict with our own newer provided runtime; a workaround is to install everything from conda-forge.

This should work:

conda install openturns theano pymc3 -c conda-forge

Upvotes: 2

Related Questions