ioam / topographica

A general-purpose neural simulator focusing on topographic maps.
topographica.org
BSD 3-Clause "New" or "Revised" License
53 stars 32 forks source link

IPython problems on Ubuntu 12.04 #532

Closed ceball closed 10 years ago

ceball commented 11 years ago
$ cat /etc/issue
Ubuntu 12.04.3 LTS \n \l

I followed the instructions for installing dependencies on Ubuntu (http://topographica.org/Downloads/index.html#quick-recipe-for-ubuntu-linux). I then cloned the repository. When I ran ./topographica, I got:

INFO:root:Time: 000000.00 CommandLine: Creating /home/ceball/Documents/Topographica
INFO:root:Time: 000000.00 OpenMP: Using 2 threads on a machine with 2 detected CPUs
Output path: /home/ceball/Documents/Topographica

Welcome to Topographica!

Type help() for interactive help with python, help(topo) for general
information about Topographica, help(commandname) for info on a
specific command, or topo.about() for info on this release, including
licensing information.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/ceball/uoe/topographica/topographica in <module>()
     35 # Process the command-line arguments

     36 from topo.misc.commandline import process_argv
---> 37 process_argv(argv[1:])

/home/ceball/uoe/topographica/topo/misc/commandline.py in process_argv(argv)
    663
    664             # Load Topographica IPython extension in embedded shell

--> 665             ipshell.extension_manager.load_extension('topo.misc.ipython')
    666             ipshell()
    667             sys.exit()

/usr/lib/python2.7/dist-packages/IPython/core/extensions.pyc in load_extension(self, module_str)
     85         if module_str not in sys.modules:
     86             with prepended_to_syspath(self.ipython_extension_dir):
---> 87                 __import__(module_str)
     88         mod = sys.modules[module_str]
     89         return self._call_load_ipython_extension(mod)

/home/ceball/uoe/topographica/topo/misc/ipython.py in <module>()
     17     from IPython.display import HTML, Javascript, display
     18 except:
---> 19     from nose.plugins.skip import SkipTest
     20     raise SkipTest("IPython extension requires IPython >= 0.12")
     21

ImportError: No module named nose.plugins.skip
>>> 

I then did 'apt-get install python-nose', which changed the error to:

---------------------------------------------------------------------------
SkipTest                                  Traceback (most recent call last)
/home/ceball/uoe/topographica/topographica in <module>()
     35 # Process the command-line arguments

     36 from topo.misc.commandline import process_argv
---> 37 process_argv(argv[1:])

/home/ceball/uoe/topographica/topo/misc/commandline.pyc in process_argv(argv)
    663
    664             # Load Topographica IPython extension in embedded shell

--> 665             ipshell.extension_manager.load_extension('topo.misc.ipython')
    666             ipshell()
    667             sys.exit()

/usr/lib/python2.7/dist-packages/IPython/core/extensions.pyc in load_extension(self, module_str)
     85         if module_str not in sys.modules:
     86             with prepended_to_syspath(self.ipython_extension_dir):
---> 87                 __import__(module_str)
     88         mod = sys.modules[module_str]
     89         return self._call_load_ipython_extension(mod)

/home/ceball/uoe/topographica/topo/misc/ipython.py in <module>()
     18 except:
     19     from nose.plugins.skip import SkipTest
---> 20     raise SkipTest("IPython extension requires IPython >= 0.12")
     21
     22

SkipTest: IPython extension requires IPython >= 0.12
>>> 

Based on "IPython.core.display or IPython.display ?" (http://python.6.x6.nabble.com/IPython-core-display-or-IPython-display-td5023256.html), I made a change that solved the problem for me:

$ git diff
diff --git a/topo/misc/ipython.py b/topo/misc/ipython.py
index c8edbff..315670b 100644
--- a/topo/misc/ipython.py
+++ b/topo/misc/ipython.py
@@ -14,7 +14,7 @@ from matplotlib import pyplot as plt

 try:
     from IPython.core.pylabtools import print_figure
-    from IPython.display import HTML, Javascript, display
+    from IPython.core.display import HTML, Javascript, display
 except:
     from nose.plugins.skip import SkipTest
     raise SkipTest("IPython extension requires IPython >= 0.12")
ceball commented 11 years ago

The version of IPython:

topo_t000000.00_c1>>> import IPython
topo_t000000.00_c2>>> IPython.__version__
               Out[2]:'0.12.1'
jbednar commented 11 years ago

That's odd, since doozy is running Ubuntu 12.04 and tests pass there. Jean-Luc would want us to have a newer IPython (it's now at 1.1, I think!), but we do still need to make sure it runs on Ubuntu 12.04, which is not all that old and is a "Long-Term Stable" release.

ceball commented 11 years ago

Maybe doozy's version of ipython has been upgraded independently of apt? Note /usr/local below:

ceball@doozy:~/topographica$ ./topographica 
INFO:root:Time: 000000.00 CommandLine: Creating /home/ceball/Documents/Topographica
INFO:root:Time: 000000.00 OpenMP: Using 2 threads on a machine with 2 detected CPUs
Output path: /home/ceball/Documents/Topographica

Welcome to Topographica!

Type help() for interactive help with python, help(topo) for general
information about Topographica, help(commandname) for info on a
specific command, or topo.about() for info on this release, including
licensing information.

topo_t000000.00_c1>>> import IPython

topo_t000000.00_c2>>> IPython.__version__
               Out[2]:'0.13.1'

topo_t000000.00_c3>>> IPython.__file__
               Out[3]:'/usr/local/lib/python2.7/dist-packages/ipython-0.13.1-py2.7.egg/IPython/__init__.pyc'
ceball commented 10 years ago

I've just updated (87f64b58c777721d148752c025b3b2820947b5e1), and now I get a different error (sorry, haven't made any attempt to investigate):

$ cat /etc/issue
Ubuntu 12.04.4 LTS \n \l
$ ./topographica -i
Output path: /home/ceball/Documents/Topographica

Welcome to Topographica!

Type help() for interactive help with python, help(topo) for general
information about Topographica, help(commandname) for info on a
specific command, or topo.about() for info on this release, including
licensing information.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/ceball/uoe/topographica/topographica in <module>()
     39 # Process the command-line arguments

     40 from topo.misc.commandline import process_argv
---> 41 process_argv(argv[1:])

/home/ceball/uoe/topographica/topo/misc/commandline.pyc in process_argv(argv)
    767
    768             # Load Topographica IPython extension in embedded shell

--> 769             ipshell.extension_manager.load_extension('topo.misc.ipython')
    770             ipshell()
    771

/usr/lib/python2.7/dist-packages/IPython/core/extensions.pyc in load_extension(self, module_str)
     85         if module_str not in sys.modules:
     86             with prepended_to_syspath(self.ipython_extension_dir):
---> 87                 __import__(module_str)
     88         mod = sys.modules[module_str]
     89         return self._call_load_ipython_extension(mod)

/home/ceball/uoe/topographica/topo/misc/ipython.py in <module>()
    169 #===============#

    170
--> 171 from dataviews.ipython import load_ipython_extension as load_imagen_extension
    172 from dataviews.ipython import stack_display, view_display
    173

/home/ceball/uoe/topographica/external/imagen/dataviews/ipython.py in <module>()
      5 from IPython.core.pylabtools import print_figure
      6 from IPython.core import page
----> 7 from IPython.core.magic import Magics, magics_class, line_magic
      8
      9 import param

ImportError: cannot import name Magics
jbednar commented 10 years ago

That's still related to having a too-old version of IPython; the Magics support changed in a later version. I've asked Jean-Luc to make sure that things still run (even if some features have to be disabled) in older IPythons, until the newer versions become more widely installed.

jlstevens commented 10 years ago

I would hope this has been fixed now!

I'll close this issue now but if there is still a problem I'll reopen it again.