Sanskar Soni
Sanskar Soni

Reputation: 21

Cannot import name 'MRG_RandomStreams' from 'theano.sandbox.rng_mrg'

I tried importing Lasagne in my code which is as follows:

from __future__ import print_function
import sys
import os
import time
import string
import random
import pickle
import numpy as np
import theano
import theano.tensor as T
import lasagne

But on running the file I keep getting the following error:

  File "main_cifar_100_theano.py", line 12, in <module>
    import lasagne
  File "/usr/local/lib/python3.7/dist-packages/lasagne/__init__.py", line 19, in <module>
    from . import layers
  File "/usr/local/lib/python3.7/dist-packages/lasagne/layers/__init__.py", line 5, in <module>
    from .noise import *
  File "/usr/local/lib/python3.7/dist-packages/lasagne/layers/noise.py", line 6, in <module>
    from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
ImportError: cannot import name 'MRG_RandomStreams' from 'theano.sandbox.rng_mrg' (/usr/local/lib/python3.7/dist-packages/theano/sandbox/rng_mrg.py)

Please help me resolve this issue.

Upvotes: 2

Views: 923

Answers (1)

user23344927
user23344927

Reputation: 1

Had the same issue and could fix it: look for your theano installation and find the path of theano/sandbox there you should find rng_mrg.py file. Edit it: line 706 append an "s": "class MRG_RandomStreams:" instead of "class MRG_RandomStream:"

Save file.

Upvotes: 0

Related Questions