Theano / Theano

Theano was a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. It is being continued as PyTensor: www.github.com/pymc-devs/pytensor

Home Page:https://www.github.com/pymc-devs/pytensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'theano' has no attribute 'gof'

ls-chris-hemmens opened this issue · comments

I'm trying to use PyMC3 with Anaconda 3 and recently have had a problem importing it. I'm using a MacBook Pro and today updated to macOS Mojave.

Here's the error report:

import pymc3 as pm

You can find the C code in this temporary file: /var/folders/7n/qgmwpjq55dz2qky6sqmb8hvh0000gp/T/theano_compilation_error_60mfdyq9
Traceback (most recent call last):

  File "<ipython-input-95-1a95cb4612db>", line 1, in <module>
    import pymc3 as pm

  File "/Users/c/anaconda3/lib/python3.6/site-packages/pymc3/__init__.py", line 5, in <module>
    from .distributions import *

  File "/Users/c/anaconda3/lib/python3.6/site-packages/pymc3/distributions/__init__.py", line 1, in <module>
    from . import timeseries

  File "/Users/c/anaconda3/lib/python3.6/site-packages/pymc3/distributions/timeseries.py", line 1, in <module>
    import theano.tensor as tt

  File "/Users/c/anaconda3/lib/python3.6/site-packages/theano/__init__.py", line 110, in <module>
    from theano.compile import (

  File "/Users/c/anaconda3/lib/python3.6/site-packages/theano/compile/__init__.py", line 12, in <module>
    from theano.compile.mode import *

  File "/Users/c/anaconda3/lib/python3.6/site-packages/theano/compile/mode.py", line 11, in <module>
    import theano.gof.vm

  File "/Users/c/anaconda3/lib/python3.6/site-packages/theano/gof/vm.py", line 683, in <module>
    except (OSError, theano.gof.cmodule.MissingGXX) as e:

AttributeError: module 'theano' has no attribute 'gof'

Thanks.

I think this is the same as #6645

Hopefully it is. Thanks for sharing this.

I am using Anaconda 2019.07 for Windows with Python 3.7. When importing PyMC3 I've had the problems with Theano as here mentioned. I have got rid of them with:

  1. conda install theano
  2. conda install pygpu
  3. pip install pymc3

Dont's ask why this should work - it does work for me.
I have to to add, that during the course of the (unsuccessful) journey to find a remedy I did also:

  1. conda install mkl-service libpython m2w64-toolchain
  2. conda install -c conda-forge blas

So I dont know wether these installations are important too. Finally PyMC3 did not run until the 3 steps mentioned above had been done. Now I can even run it within Jupyter with all 4 cores:

trace = pm.sample(2000, tune=1000) #, cores=1

I do not have to reduce to 1 core (trace = pm.sample(2000, tune=1000, cores=1)

I've just re-installed Catalina and was having problems with this again, I found a solution and thought I'd post it in case anyone else runs into the same issue: still getting compile errors talking about issues with missing members from math.h, e.g. isunordered

Follow the advice above with installing Theano etc, but I also needed to add these lines:

import theano
theano.config.gcc.cxxflags = '-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wno-c++11-narrowing'