[solved] Lession 1 - import utils throw `ImportError: cannot import name opt`


I use my own ubuntu16 server, python2.7 virtualenv in anaconda3.

In lesson 1, when I run command import utils; in basic setup section in lesson1.ipynb, error as below appears.
I do have theano installed via pip already and .theanorc has correct content.
The same error is discussed here without solution offered: Lesson 1 - ImportError with Theano

Any help is appreciated!

.theanorc content

❯ cat ~/.theanorc                                                                                                                                                                      
device = gpu
floatX = float32
root = /usr/local/cuda


ImportError                               Traceback (most recent call last)
<ipython-input-28-2e78bbaaa150> in <module>()
----> 1 import utils; #reload(utils)
      2 #from utils import plots

/home/finxxi/projects/courses/deeplearning1/nbs/utils.py in <module>()
     26 from IPython.lib.display import FileLink
---> 28 import theano
     29 from theano import shared, tensor as T
     30 from theano.tensor.nnet import conv2d, nnet

/home/finxxi/anaconda3/envs/py27/lib/python2.7/site-packages/theano/__init__.py in <module>()
    122 from theano.printing import pprint, pp
--> 124 from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
    125                                 scan_checkpoints)

/home/finxxi/anaconda3/envs/py27/lib/python2.7/site-packages/theano/scan_module/__init__.py in <module>()
     39 __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
---> 41 from theano.scan_module import scan_opt
     42 from theano.scan_module.scan import scan
     43 from theano.scan_module.scan_checkpoints import scan_checkpoints

/home/finxxi/anaconda3/envs/py27/lib/python2.7/site-packages/theano/scan_module/scan_opt.py in <module>()
     59 import theano
---> 60 from theano import tensor, scalar
     61 from theano.tensor import opt, get_scalar_constant_value, Alloc, AllocEmpty
     62 from theano import gof

/home/finxxi/anaconda3/envs/py27/lib/python2.7/site-packages/theano/tensor/__init__.py in <module>()
     13     TensorConstantSignature, TensorConstant)
---> 15 from theano.tensor import opt
     16 from theano.tensor import opt_uncanonicalize
     17 from theano.tensor import blas

ImportError: cannot import name opt

no idea what happened… now everything went well. Perhaps a reboot and config file change made the difference.

I have this problem too! I’m trying to reboot everything…

Hi, I tried the things you have suggested above, and its still not working. What do you think I can look at next?

Here is in theanorc

device = cuda
floatX = flat32
preallocate = 1

I also added export MKL_THREADING_LAYER=GNU to my bashrc due to a previous error.

Thanks in advance.