Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python lasagne ImportError cannot import BatchNormLayer

When I try to play with the code here, I met a very strange error. Every other modules can be imported properly, except for one.

Specifically, the error is:

ImportError: cannot import name BatchNormLayer

from the file here. And the lasagne_extensions.layers is as following:

from .density_layers import *
from lasagne.layers import *
from parmesan.layers import *

So, I believe the problem should be that I didn't install lasagne or parmesan properly.

I have tried to upgrade the relevant modules including numpy, scipy, theano and lasagne to newest version with pip install --upgrade respectively. There is no pip install support for parmesan, so I downloaded it and installed it again. However, the error remains.

Can anyone give me some advice about what I should look into?

like image 601
Haohan Wang Avatar asked Mar 18 '16 15:03

Haohan Wang


1 Answers

The solution is to install the cutting-edge version, and pip install --upgrade does not do that.

But the problem can be solved by:

pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip

Details are here.

like image 144
Haohan Wang Avatar answered Oct 07 '22 15:10

Haohan Wang