0

I am trying to import a library called pylearn2 in spyder (anaconda). I get an error that the module is not found. I try from pylearn2 import models I get the following error:

    from  pylearn2 import models
  File "pylearn2.py", line 1, in <module>
    from  pylearn2 import models
ImportError: cannot import name models

If I type import pylearn. the intellisense includes all options, including models.

If I open ipython notebook I can run the command.

I added various levels of the path to the PYTHONPATH variable using Spyder's manager but to no effect. Any idea why this is happening? I updated spyder via conda and at using python 2.7.

EDIT: Additional info:

The command import pylearn2 appears to work The pythonpath is the same between spyder and ipython notebook:

 '', '/home/jma/anaconda/lib/python2.7/site-packages/Lasagne-0.1.dev0-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/nolearn-0.6a0.dev0-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/joblib-0.8.4-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/argparse-1.3.0-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/pylearn2',

'/home/jma/anaconda/lib/python27.zip',

'/home/jma/anaconda/lib/python2.7',

'/home/jma/anaconda/lib/python2.7/plat-linux2',

'/home/jma/anaconda/lib/python2.7/lib-tk',

'/home/jma/anaconda/lib/python2.7/lib-old',

'/home/jma/anaconda/lib/python2.7/lib-dynload',

'/home/jma/anaconda/lib/python2.7/site-packages/runipy-0.1.1-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/setuptools-15.0-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages',

'/home/jma/anaconda/lib/python2.7/site-packages/PIL',

'/home/jma/anaconda/lib/python2.7/site-packages/Sphinx-1.2.3-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/IPython/extensions
asmeurer
  • 86,894
  • 26
  • 169
  • 240
B_Miner
  • 1,840
  • 4
  • 31
  • 66
  • You could [check](http://stackoverflow.com/questions/1093322/how-do-i-check-what-version-of-python-is-running-my-script) the version of python each are running and compare them. – MaxQ Apr 12 '15 at 15:42
  • 2.7.9 |Anaconda 2.1.0 (64-bit)| (default, Mar 9 2015, 16:20:48) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] – B_Miner Apr 12 '15 at 15:44
  • Both are exactly the same. – B_Miner Apr 12 '15 at 15:45
  • I think the problem is you have a file called `pylearn2.py` that you're trying to evaluate or call from another file. If that's the case, just renaming it should solve the problem :-) – Carlos Cordoba Apr 14 '15 at 19:22

0 Answers0