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

running topographica got error: through git installed; run ./topographica or run ./topographica -g #594

Closed zdx3578 closed 9 years ago

zdx3578 commented 10 years ago

when i install it use git when running , error:

root@iZ94dcgzdw8Z:~/Downloads/topographica# ./topographica -g ./examples/tiny.ty Traceback (most recent call last): File "./topographica", line 17, in process_argv(sys.argv[1:]) File "/root/Downloads/topographica/topo/misc/commandline.py", line 714, in process_argv (option,args) = topo_parser.parse_args(args,option) File "/usr/lib/python2.7/optparse.py", line 1399, in parse_args stop = self._process_args(largs, rargs, values) File "/usr/lib/python2.7/optparse.py", line 1443, in _process_args self._process_short_opts(rargs, values) File "/usr/lib/python2.7/optparse.py", line 1550, in _process_short_opts option.process(opt, value, values, self) File "/usr/lib/python2.7/optparse.py", line 788, in process self.action, self.dest, opt, value, values, parser) File "/usr/lib/python2.7/optparse.py", line 808, in take_action self.callback(self, opt, value, parser, _args, _kwargs) File "/root/Downloads/topographica/topo/misc/commandline.py", line 464, in g_action gui() File "/root/Downloads/topographica/topo/misc/commandline.py", line 452, in gui auto_import_commands() File "/root/Downloads/topographica/topo/misc/commandline.py", line 539, in auto_import_commands exec "from topo.command."+modulename+" import " in main.dict File "", line 1, in File "/root/Downloads/topographica/topo/command/init.py", line 38, in from topo.base.sheet import Sheet File "/root/Downloads/topographica/topo/base/sheet.py", line 32, in from dataviews.collector import AttrTree File "/root/Downloads/topographica/external/dataviews/dataviews/collector.py", line 14, in from .ipython.widgets import RunProgress, ProgressBar File "/root/Downloads/topographica/external/dataviews/dataviews/ipython/init.py", line 3, in from ..styles import set_style File "/root/Downloads/topographica/external/dataviews/dataviews/styles/init.py", line 10, in from matplotlib import rc_params_from_file ImportError: cannot import name rc_params_from_file

root@iZ94dcgzdw8Z:~/Downloads/topographica# ./topographica
Output path: /root/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) /root/Downloads/topographica/topographica in () 15 # Process the command-line arguments

 16 from topo.misc.commandline import process_argv

---> 17 process_argv(sys.argv[1:])

/root/Downloads/topographica/topo/misc/commandline.pyc in process_argv(argv) 783 784 # Load Topographica IPython extension in embedded shell

--> 785 ipshell.extension_manager.load_extension('topo.misc.ipython') 786 ipshell() 787

/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)

/root/Downloads/topographica/topo/misc/ipython.py in () 17 from IPython.core.magic import Magics, magics_class, line_magic 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

zdx3578 commented 10 years ago

I try running topographica,i use Ubuntu 12.04.5 LTS(vm in www.aliyun.com) and install gnome : apt-get install xserver-xorg xfont* gnome gdm then follow https://github.com/ioam/topographica installed; when running show up error.

ceball commented 10 years ago

I also use Ubuntu 12.04, and I can reproduce both of your problems (i.e. "IPython warning" without -g and "matplotlib error" with -g) when I use the Ubuntu system python. However, the "IPython warning" does not actually stop you from using Topographica (although you'll be without the tk gui), even though at first glance it looks like an error.

I have Ubuntu 12.04 too, but I don't use the system Python any more. Instead, I use the Anaconda distribution of python (free from http://continuum.io/downloads, linux, 64 bits, python 2.7), and the latest git version of topographica seems to work fine for me, without warnings or errors. I'm not sure what the currently recommend approach to running Topographica is, but this is what I do.

I guess one alternative for you is to update your versions of IPython and matplotlib (e.g. using pip?), but that always seems to be more difficult to me than just using a ready made distribution of a scientific Python environment (e.g. Anaconda or Enthought's EPD).

(Note for developers: matplotlib version here is 1.1.1rc. Should we do something like have a pip "dependencies.txt" file in the repository to specify dependencies and versions (and possibly a second "optional-dependencies.txt" file)? Then if someone can't execute pip install -r 'dependencies.txt' successfully they know they won't be able to run the git version of topographica. I'm out of touch with what's happening with python packaging tools.)

philippjfr commented 10 years ago

The first error you're encountering is definitely down to the matplotlib version. That was introduced as part of our styling system in DataViews, so I'll try to make that code a bit more compatible with older versions.

The second error is down to nose, which as far as I can tell is actually a hard dependency for us. So I definitely think we should ship a pip requirements.txt with all our projects. In fact when publishing something we should always include an up to date requirements file with the tag, since it's the easiest and most succinct method to recreate a particular environment. This will probably have to wait until Jean-Luc and I return from SfN, and while we're at it we'll also release DataViews.

jlstevens commented 10 years ago

The nose issue is something Jim and I discussed but never got round to fixing. I think we can just use unittest.SkipTest instead of using nose here. Anyone fancy actually making this fix?

ceball commented 10 years ago

Oh, sorry, so I was wrong - what I called the "IPython warning" is actually an error. I confused myself about the wording!

ceball commented 10 years ago

The nose issue is something Jim and I discussed but never got round to fixing. I think we can just use unittest.SkipTest instead of using nose here. Anyone fancy actually making this fix?

I don't quite understand what you want to happen. If I have nose, I get the error SkipTest: IPython extension requires IPython >= 0.12 and no IPython. If I don't have nose, I get the error ImportError: No module named nose.plugins.skip. But if I make the change below, things seem to work:

diff --git a/topo/misc/commandline.py b/topo/misc/commandline.py
index c48e9e4..d708e50 100644
--- a/topo/misc/commandline.py
+++ b/topo/misc/commandline.py
@@ -782,7 +782,7 @@ def process_argv(argv):
                 ipshell.call_pdb = True

             # Load Topographica IPython extension in embedded shell
-            ipshell.extension_manager.load_extension('topo.misc.ipython')
+            #ipshell.extension_manager.load_extension('topo.misc.ipython')
             ipshell()

     global return_code

If the extension topo.misc.ipython cannot be loaded, does that mean getting an IPython shell should be aborted? Or just that loading the extension should be skipped (and I can still have an impoverished IPython shell)? Maybe you mean both that skiptest should be supplied from unittest rather than nose (allowing tests to be marked as skipped where appropriate even if someone doesn't have nose) and that there should be a try/except around loading the ipython extension.

Philipp indicated that nose is a required dependency anyway, for something else?

philippjfr commented 10 years ago

I think I was probably wrong about nose being a hard dependency. I thought it's what we were using for SkipTest generally but since we now require python 2.7 and SkipTest was introduced to unittest under 2.7, I guess that's not actually true or at the very least doesn't have to be the case.

jlstevens commented 10 years ago

Maybe you mean both that skiptest should be supplied from unittest rather than nose (allowing tests to be marked as skipped where appropriate even if someone doesn't have nose) and that there should be a try/except around loading the ipython extension.

Right.

ceball commented 9 years ago

I think we finally managed to fix this (supporting older matplotlibs, not requiring nose, making ipython extension optional).