示例#1
0
 def compile_modfiles(cls, modelpath):
     with working_dir(dirname(modelpath)):
         out = 0
         if len(glob('*.mod')) > 0:
             environment_vars, path = NeuronEngine.get_nrn_environment()
             inform('Compiling all mod files in directory: %s' %
                    dirname(modelpath),
                    indent=1)
             out = check_output([path + '/nrnivmodl'])
             inform(out, indent=2)
         elif len(glob('modfiles/*.mod')) > 0:
             environment_vars, path = NeuronEngine.get_nrn_environment()
             mod_file_path = dirname(modelpath) + "/modfiles"
             inform('Compiling all mod files in directory: %s' %
                    mod_file_path,
                    indent=1)
             out = check_output([path + '/nrnivmodl', 'modfiles'])
             inform(out, indent=2)
         elif len(glob('mod_files/*.mod')) > 0:
             environment_vars, path = NeuronEngine.get_nrn_environment()
             mod_file_path = dirname(modelpath) + "/mod_files"
             inform('Compiling all mod files in directory: %s' %
                    mod_file_path,
                    indent=1)
             out = check_output([path + '/nrnivmodl', 'mod_files'])
             inform(out, indent=2)
     return out
示例#2
0
def install_netpyne():
    install_root = os.environ['HOME']
    install_dir = 'netpyneInstall'
    path = os.path.join(install_root, install_dir)

    if not os.path.isdir(path):
        with working_dir(install_root):
            print(
                check_output([
                    'git', 'clone',
                    'https://github.com/Neurosim-lab/netpyne.git', install_dir
                ]))

    with working_dir(path):
        print(check_output(['git', 'checkout', 'neuroml_updates']))
        print(check_output(['pwd']))

    with working_dir(path):
        if sys.version_info.major == 2:
            #pip_install([]'setuptools==42.0.1')
            pip_install([
                'kiwisolver==1.0.1', 'matplotlib==2.2.4', 'pandas==0.23.4',
                'bokeh==1.4.0', 'Pillow==5.4.1', 'matplotlib-scalebar==0.5.1',
                'scipy==1.2.2', 'python-dateutil==2.8.0'
            ])
        print(check_output([sys.executable, 'setup.py', 'install']))

    m = 'Successfully installed NetPyNE...'
    def install(version):
        if not NeuronEngine.is_installed(None):
            NeuronEngine.install(None)
            inform("%s installed NEURON..." % PyNNNRNEngine.name, indent=2, verbosity =1)
        if not PyNNEngine.is_installed(None):
            PyNNEngine.install(None)
            inform("%s installed PyNN..." % PyNNNRNEngine.name, indent=2, verbosity =1)

        PyNNNRNEngine.path = PyNNEngine.path + \
            ":" + NeuronEngine.path
        PyNNNRNEngine.environment_vars = {}
        PyNNNRNEngine.environment_vars.update(
            PyNNEngine.environment_vars)
        PyNNNRNEngine.environment_vars.update(
            NeuronEngine.environment_vars)
        inform("PATH: " + PyNNNRNEngine.path, indent=2, verbosity =1)
        inform("Env vars: %s" % PyNNNRNEngine.environment_vars, indent=2, verbosity =1)
        
        pynn_loc = sp.check_output(['python -c "import pyNN,os; print(os.path.dirname(pyNN.__file__))"'], shell=True,stderr=sp.STDOUT).strip()
        pynn_mod_dir = '%s/neuron/nmodl/'%pynn_loc
        
        inform("Attempting to compile PyNN mod files for standard models in %s..."%pynn_mod_dir, indent=2, verbosity =1)
        
        print(check_output(['ls', pynn_mod_dir], cwd=pynn_mod_dir))
        
        environment_vars, path = NeuronEngine.get_nrn_environment()
        inform("Using NEURON with env %s at %s..."%(environment_vars, path), indent=2, verbosity =1)
        
        print(check_output([environment_vars['NEURON_HOME']+'/bin/nrnivmodl'], cwd=pynn_mod_dir))
示例#4
0
    def is_installed(version):
        ret = True
        if is_verbose():
            inform("Checking whether %s is installed..." % NeuronEngine.name,
                   indent=1)
        try:
            output = check_output(['nrniv', '--version'], verbosity=2)
            if is_verbose():
                inform('%s is installed' % output.strip(), indent=2)
            ret = 'v%s' % output.split()[3]
        except OSError:
            try:
                environment_vars, path = NeuronEngine.get_nrn_environment()

                inform('Testing NEURON with env: %s and path: %s' %
                       (environment_vars, path),
                       indent=2)
                output = check_output([path + '/nrniv', '--version'])
                if is_verbose():
                    inform('%s was already installed (by OMV..?)' %
                           output.strip(),
                           indent=2)

                ret = 'v%s' % output.split()[3]
            except OSError:
                inform('NEURON not currently installed', indent=2)
                ret = False
        return ret
示例#5
0
 def run(self):
     try:
         inform("Running file %s with %s" % (trim_path(self.modelpath), JNeuroMLBrianEngine.name), indent=1)
         self.stdout = check_output(['jnml' if os.name != 'nt' else 'jnml.bat', self.modelpath, '-brian'], cwd=os.path.dirname(self.modelpath))
         self.stdout += check_output(['python', self.modelpath.replace('.xml', '_brian.py'), '-nogui'], cwd=os.path.dirname(self.modelpath))
         inform("Success with running ", JNeuroMLBrianEngine.name, indent=1)
         self.returncode = 0
     except sp.CalledProcessError as err:
         inform("Error with ", JNeuroMLBrianEngine.name, indent=1)
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
 def run(self):
     try:
         inform("Running file %s with %s" % (trim_path(self.modelpath), JNeuroMLMooseEngine.name), indent=1)
         self.stdout = check_output(['jnml' if os.name != 'nt' else 'jnml.bat', self.modelpath, '-moose'], cwd=os.path.dirname(self.modelpath))
         self.stdout += check_output(['python', self.modelpath.replace('.xml', '_moose.py'), '-nogui'], cwd=os.path.dirname(self.modelpath))
         inform("Success with running ", JNeuroMLMooseEngine.name, indent=1)
         self.returncode = 0
     except sp.CalledProcessError as err:
         inform("Error with ", JNeuroMLMooseEngine.name, indent=1)
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
def install_pylems():
    
    install_root = os.environ['HOME']
    
    with working_dir(install_root):
        check_output(['git', 'clone', 'https://github.com/LEMS/pylems.git'])
        inform('Successfully cloned PyLEMS', indent=2, verbosity=1)
    
    path = os.path.join(install_root,'pylems')
    
    with working_dir(path):
        check_output(['python', 'setup.py', 'install'])
        inform('Successfully installed PyLEMS', indent=2, verbosity=1)
示例#8
0
def install_pylems():

    install_root = os.environ['HOME']

    with working_dir(install_root):
        check_output(['git', 'clone', 'https://github.com/LEMS/pylems.git'])
        inform('Successfully cloned PyLEMS', indent=2, verbosity=1)

    path = os.path.join(install_root, 'pylems')

    with working_dir(path):
        check_output(['python', 'setup.py', 'install'])
        inform('Successfully installed PyLEMS', indent=2, verbosity=1)
def install_netpyne():
    install_root = os.environ['HOME']

    with working_dir(install_root):
        print(check_output(['git', 'clone', 'https://github.com/Neurosim-lab/netpyne.git', 'netpyneInstall']))

    path = os.path.join(install_root,'netpyneInstall')

    with working_dir(path):
        print(check_output(['git', 'checkout', 'neuroml_updates']))
        print(check_output(['pwd']))
        print(check_output(['python', 'setup.py', 'install']))

    m = 'Successfully installed NetPyNE...'
    def is_installed(version):
        ret = True

        environment_vars = NestEngine.get_nest_environment()

        try:
            FNULL = open(os.devnull, 'w')

            check_output([environment_vars['NEST_HOME'] + 'bin/nest', '-v'],
                         verbosity=is_verbose())
        except OSError as err:
            inform("Couldn't execute NEST: ", err, indent=1)
            ret = False
        return ret
 def is_installed(version):
     
     PyNestEngine.environment_vars = NestEngine.get_nest_environment()
     
     ret = True
     try:
         
         ret_str = check_output(['python -c "import nest; print(nest.version())"'], shell=True, verbosity=2)
         ret = len(ret_str) > 0
         
         if ret:
             ret = 'v%s'%ret_str.split('Version')[-1].split()[0]
         
         if ret and is_verbose():
             inform("%s is correctly installed..." % (PyNestEngine.name), indent=2)
         
         if is_verbose():
             inform("NEST is installed with Python support...", indent=2)
             inform("Env vars: %s" % PyNestEngine.environment_vars, indent=2)
         
     except Exception as err:
         inform("Couldn't import NEST into Python: ", err, indent=1)
         inform("NEST env vars: %s" % PyNestEngine.environment_vars, indent=1)
         ret = False
     return ret
示例#12
0
    def run(self):

        np = 2

        try:
            inform("Running file %s with %s" %
                   (trim_path(self.modelpath), JNeuroMLNetPyNEEngine.name),
                   indent=1)

            from omv.engines.jneuroml import JNeuroMLEngine
            jnml = JNeuroMLEngine.get_executable()
            self.stdout = check_output([
                jnml, self.modelpath, '-netpyne', '-nogui', '-run', '-np',
                '%s' % np
            ],
                                       cwd=os.path.dirname(self.modelpath),
                                       env=JNeuroMLEngine.get_environment())
            inform("Success with running ",
                   JNeuroMLNetPyNEEngine.name,
                   indent=1)
            self.returncode = 0
        except sp.CalledProcessError as err:
            inform("Error with ", JNeuroMLNetPyNEEngine.name, indent=1)
            self.returncode = err.returncode
            self.stdout = err.output
            raise EngineExecutionError
示例#13
0
    def run(self):

        try:
            self.stdout = PyNRNEngine.compile_modfiles(self.modelpath)
        except sp.CalledProcessError as err:
            self.stderr = err.output
            self.returncode = err.returncode
            inform('Error compiling modfiles:', self.stderr, indent=2)

        try:
            inform("Running file %s with %s" %
                   (trim_path(self.modelpath), self.name),
                   indent=1)
            self.stdout = check_output([
                'mpiexec', '-np', '2', 'nrniv', '-mpi', self.modelpath,
                '-nogui'
            ],
                                       cwd=os.path.dirname(self.modelpath))
            self.returncode = 0
        except sp.CalledProcessError as err:
            self.returncode = err.returncode
            self.stdout = err.output
            raise EngineExecutionError
        except Exception as err:
            inform("Another error with running %s: " % self.name,
                   err,
                   indent=1)
            self.returncode = -1
            self.stdout = "???"
示例#14
0
    def is_installed(version):

        PyNestEngine.environment_vars = NestEngine.get_nest_environment()

        ret = True
        try:

            ret_str = check_output(
                ['python -c "import nest; print(nest.version())"'], shell=True)
            ret = len(ret_str) > 0

            if ret and is_verbose():
                inform("%s is correctly installed..." % (PyNestEngine.name),
                       indent=2)

            if is_verbose():
                inform("NEST is installed with Python support...", indent=2)
                inform("Env vars: %s" % PyNestEngine.environment_vars,
                       indent=2)

        except Exception as err:
            inform("Couldn't import NEST into Python: ", err, indent=1)
            inform("NEST env vars: %s" % PyNestEngine.environment_vars,
                   indent=1)
            ret = False
        return ret
示例#15
0
 def run(self):
     try:
         inform("Running file %s with %s" % (trim_path(self.modelpath), JNeuroMLBrianEngine.name), indent=1)
         
         from omv.engines.jneuroml import JNeuroMLEngine
         jnml = JNeuroMLEngine.get_executable()
         
         self.stdout = check_output([jnml, self.modelpath, '-brian'], cwd=os.path.dirname(self.modelpath),env=JNeuroMLEngine.get_environment())
         self.stdout += check_output(['python', self.modelpath.replace('.xml', '_brian.py'), '-nogui'], cwd=os.path.dirname(self.modelpath))
         inform("Success with running ", JNeuroMLBrianEngine.name, indent=1)
         self.returncode = 0
     except sp.CalledProcessError as err:
         inform("Error with ", JNeuroMLBrianEngine.name, indent=1)
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
示例#16
0
def install_pynn():
    try:
        
        print(check_output(['pip', 'install', 'lazyarray']))  # This should ideally be automatically installed with PyNN...
        print(check_output(['pip', 'install', 'neo==0.5.1']))  # This should ideally be automatically installed with PyNN...

        install_root = os.environ['HOME']

        pyNN_src = 'PyNN_src'
        with working_dir(install_root):
            check_output(['git', 'clone', 'https://github.com/NeuralEnsemble/PyNN.git', pyNN_src])

        path = os.path.join(install_root, pyNN_src)

        with working_dir(path):
            print(check_output(['git','checkout','neuroml']))  # neuroml branch has the latest NML2 import/export code!
            #check_output(['git','checkout','master'])
            print(check_output(['python', 'setup.py', 'install']))
            print(check_output(['pwd']))
            print("Finished attempting to install PyNN")
        #import pyNN
        m = 'Successfully installed pyNN...'
    except Exception as e:
        m = 'ERROR during install_pynn: %s'%e
    finally:
        inform(m)
 def is_installed(version):
     ret = True
     try:
         ret_str = check_output(['lems', '-h'], verbosity=1)
         ret = 'v%s'%ret_str.split('-jar')[-1].split()[0].split('-')[1][:-4]
     except OSError as err:
         inform("Couldn't execute lems:", err, indent=1)
         ret = False
     return ret
示例#18
0
    def is_installed(version):
        ret = True

        try:
            print(check_output(['octave', '-v']))
        except OSError as err:
            inform("Couldn't execute Octave!", err, indent=1)
            ret = False
        return ret
示例#19
0
 def is_installed(version):
     ret = True
     try:
         ret_str = check_output(['lems', '-h'], verbosity=1)
         ret = 'v%s' % ret_str.split('-jar')[-1].split()[0].split(
             '-')[1][:-4]
     except OSError as err:
         inform("Couldn't execute lems:", err, indent=1)
         ret = False
     return ret
 def is_installed(cls, version):
     ret = True
     
     try:
         output = check_output(['nrniv', '--version'])
         if is_verbose():
             inform('%s was already installed locally'%output.strip(), indent=2)
     except OSError:
         try:
             environment_vars, path = NeuronEngine.get_nrn_environment()
             
             inform('Testing NEURON with env: %s and path: %s'%(environment_vars, path), indent=2)
             output = check_output([path+'/nrniv', '--version'])
             if is_verbose():
                 inform('%s was already installed (by OMV..?)'%output.strip(), indent=2)
         except OSError:
                 inform('NEURON not currently installed', indent=2)
                 ret = False
     return ret
def install_pynml():
    
    try:
        print(check_output(['pip', 'install', 'pyneuroml']))
        import neuroml
        import pyneuroml
        m = 'Successfully installed pyNeuroML...'
    except Exception as e:
        m = 'ERROR installing pyNeuroML: ' + str(e)
    finally:
        inform(m, indent=2)
    def is_installed(version):
        ret = True

        try:
            ret_str = check_output(['octave', '-v'], verbosity=1)

            ret = 'v%s' % str(ret_str).split()[3]
        except OSError as err:
            inform("Couldn't execute Octave!", err, indent=1)
            ret = False
        return ret
 def is_installed(version):
     ret = True
     try:
         if is_verbose():
             inform("Checking whether %s is installed..." %
                JNeuroMLEngine.name, indent=1)
         FNULL = open(os.devnull, 'w')
         r = check_output(['jnml' if os.name != 'nt' else 'jnml.bat', '-v'], verbosity=2)
         ret = '%s'%r.split()[1]
     except OSError:
         ret = False
     return ret
    def install(version):
        if not NeuronEngine.is_installed(None):
            NeuronEngine.install(None)
            inform("%s installed NEURON..." % PyNNNRNEngine.name,
                   indent=2,
                   verbosity=1)
        if not PyNNEngine.is_installed(None):
            PyNNEngine.install(None)
            inform("%s installed PyNN..." % PyNNNRNEngine.name,
                   indent=2,
                   verbosity=1)

        PyNNNRNEngine.path = PyNNEngine.path + \
            ":" + NeuronEngine.path
        PyNNNRNEngine.environment_vars = {}
        PyNNNRNEngine.environment_vars.update(PyNNEngine.environment_vars)
        PyNNNRNEngine.environment_vars.update(NeuronEngine.environment_vars)
        inform("PATH: " + PyNNNRNEngine.path, indent=2, verbosity=1)
        inform("Env vars: %s" % PyNNNRNEngine.environment_vars,
               indent=2,
               verbosity=1)
        import pyNN
        pynn_mod_dir = os.path.dirname(pyNN.__file__) + '/neuron/nmodl/'
        inform(
            "Attempting to compile PyNN mod files for standard models in %s..."
            % pynn_mod_dir,
            indent=2,
            verbosity=1)

        print(check_output(['ls', pynn_mod_dir], cwd=pynn_mod_dir))

        environment_vars, path = NeuronEngine.get_nrn_environment()
        inform("Using NEURON with env %s at %s..." % (environment_vars, path),
               indent=2,
               verbosity=1)

        print(
            check_output([environment_vars['NEURON_HOME'] + '/bin/nrnivmodl'],
                         cwd=pynn_mod_dir))
 def run(self):
     try:
         inform("Running file %s with %s" % (trim_path(self.modelpath), JNeuroMLPyNNNRNEngine.name), indent=1)
         self.stdout = check_output(
             ['jnml' if os.name != 'nt' else 'jnml.bat', self.modelpath, '-pynn', '-run-neuron'],
             cwd=os.path.dirname(self.modelpath))
         inform("Success with running ",
                JNeuroMLPyNNNRNEngine.name, indent=1)
         self.returncode = 0
     except sp.CalledProcessError as err:
         inform("Error with ", JNeuroMLPyNNNRNEngine.name, indent=1)
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
def install_brian2(version):
    if not version:
        version='2.2.2.1'
    try:
        check_scipy_dev()
        # Tested with v2.2.2.1     
        print(check_output(['pip', 'install', 'brian2==%s'%version]))
        import brian2
        m = 'Successfully installed Brian2...'
    except Exception as e:
        m = 'ERROR installing Brian2: ' + str(e)
    finally:
        print(m)
        
示例#27
0
 def run(self):
     try:
         inform("Running file %s with %s" % (trim_path(self.modelpath), self.name), indent=1)
         self.stdout = check_output(['python', self.modelpath, '-nogui'],
                                       cwd=os.path.dirname(self.modelpath))
         self.returncode = 0
     except sp.CalledProcessError as err:
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
     except Exception as err:
         inform("Another error with running %s: "%self.name, err, indent=1)
         self.returncode = -1
         self.stdout = "???"
    def is_installed(version):
        ret = True

        environment_vars = NestEngine.get_nest_environment()

        try:
            FNULL = open(os.devnull, 'w')

            r = check_output([environment_vars['NEST_HOME']+'bin/nest', '-v'], verbosity=2)
            ret = 'v%s'%r.split('version')[1].split()[0][:-1]
        except OSError as err:
            inform("Couldn't execute NEST: ", err, indent=1)
            ret = False
        return ret
示例#29
0
 def run(self):
     try:
         inform("Running file %s with %s" %
                (trim_path(self.modelpath), self.name),
                indent=1)
         self.stdout = check_output([
             'pynml' if os.name != 'nt' else 'pynml.bat', self.modelpath,
             '-nogui'
         ],
                                    cwd=os.path.dirname(self.modelpath))
         self.returncode = 0
     except sp.CalledProcessError as err:
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
    def run(self):

        self.environment_vars = NestEngine.get_nest_environment()
        self.set_environment()

        try:
            inform("Running file %s with %s" % (trim_path(self.modelpath), self.name), indent=1)
            self.stdout = check_output([self.environment_vars['NEST_HOME']+'bin/nest', self.modelpath],
                                          cwd=os.path.dirname(self.modelpath))
            self.returncode = 0
        except sp.CalledProcessError as err:
            self.returncode = err.returncode
            self.stdout = err.output
            raise EngineExecutionError
        except Exception as err:
            inform("Another error with running %s: "%self.name, err, indent=1)
            self.returncode = -1
            self.stdout = "???"
    def run(self):

        self.environment_vars = NestEngine.get_nest_environment()
        self.set_environment()

        try:
            inform("Running file %s with %s" % (trim_path(self.modelpath), self.name), indent=1)
            self.stdout = check_output([self.environment_vars['NEST_HOME']+'bin/nest', self.modelpath],
                                          cwd=os.path.dirname(self.modelpath))
            self.returncode = 0
        except sp.CalledProcessError as err:
            self.returncode = err.returncode
            self.stdout = err.output
            raise EngineExecutionError
        except Exception as err:
            inform("Another error with running %s: "%self.name, err, indent=1)
            self.returncode = -1
            self.stdout = "???"
    def is_installed(version):
        ret = True

        environment_vars = NestEngine.get_nest_environment()
        try:
            FNULL = open(os.devnull, 'w')

            r = check_output([environment_vars['NEST_HOME']+'bin/nest', '-v'], verbosity=2)
    
            ret = '%s'%r.split('version')[1].split()[0][:-1]
            if '-' in ret:
                ret = 'v%s'%ret.split('-')[-1]
                
            inform("NEST %s is correctly installed..." % ret, indent=2, verbosity=1)
            
        except OSError as err:
            inform("Couldn't execute NEST: ", err, indent=1)
            ret = False
        return ret
示例#33
0
 def run(self):
     try:
         inform("Running file %s with %s" %
                (trim_path(self.modelpath), JNeuroMLPyNNNRNEngine.name),
                indent=1)
         self.stdout = check_output([
             'jnml' if os.name != 'nt' else 'jnml.bat', self.modelpath,
             '-pynn', '-run-neuron'
         ],
                                    cwd=os.path.dirname(self.modelpath))
         inform("Success with running ",
                JNeuroMLPyNNNRNEngine.name,
                indent=1)
         self.returncode = 0
     except sp.CalledProcessError as err:
         inform("Error with ", JNeuroMLPyNNNRNEngine.name, indent=1)
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
示例#34
0
def install_brian():
    
    install_root = os.environ['HOME']
    
    with working_dir(install_root):
        check_output(['git', 'clone', 'https://github.com/brian-team/brian.git'])
        inform('Successfully cloned Brian', indent=2, verbosity=1)
    
    path = os.path.join(install_root,'brian')
    
    with working_dir(path):
        check_output(['git','checkout','master'])
        check_output(['python', 'setup.py', 'install'])
        inform('Successfully installed Brian', indent=2, verbosity=1)
示例#35
0
    def is_installed(version):
        ret = True
        try:
            if is_verbose():
                inform("Checking whether %s is installed..." %
                       JNeuroMLEngine.name,
                       indent=1)
            FNULL = open(os.devnull, 'w')
            jnml = JNeuroMLEngine.get_executable()
            r = check_output([jnml, '-v'],
                             verbosity=2,
                             env=JNeuroMLEngine.get_environment())
            ret = '%s' % r.split()[1]

            if is_verbose():
                inform("%s %s is installed..." % (JNeuroMLEngine.name, ret),
                       indent=2)
        except OSError as err:
            inform("Couldn't execute/import jNeuroML: ", err, indent=1)
            ret = False
        return ret
def install_moose():
    install_root = os.environ['HOME']
    
    with working_dir(install_root):
        print(check_output(['git', 'clone', 'https://github.com/pgleeson/moose-core.git']))

    with working_dir(os.path.join(install_root,'moose-core')):
        print(check_output(['mkdir', 'build_']))
        
    with working_dir(os.path.join(install_root,'moose-core/build_')):
        print(check_output(['cmake', '..']))
        print(check_output(['make']))
        print(check_output(['make', 'install']))
        
    with working_dir(os.path.join(install_root,'moose-core/build_/python')):
        print(check_output(['pwd']))
        print(check_output(['python', 'setup.py', 'install']))

    m = 'Successfully installed Moose...' 
示例#37
0
    def is_installed(version):

        PyNestEngine.environment_vars = NestEngine.get_nest_environment()

        ret = True
        try:

            ret_str = check_output(
                ['python -c "import nest; print(nest.version())"'],
                shell=True,
                verbosity=2)
            ret = len(ret_str) > 0

            if ret:
                ret_str = ret_str.strip().split('\n')[-1]
                #print('NEST info: %s; <<%s>>'%(ret, ret_str))
                if 'Version' in ret_str:
                    ret = 'v%s' % ret_str.split('Version')[-1].split()[0]
                elif '-' in ret_str:
                    ret = 'v%s' % ret_str.split('-')[-1].split()[0]
                else:
                    ret = 'v%s' % ret_str.split()[-1]

            if ret and is_verbose():
                inform("%s is correctly installed..." % (PyNestEngine.name),
                       indent=2)

            if is_verbose():
                inform("NEST is installed with Python support...", indent=2)
                inform("Env vars: %s" % PyNestEngine.environment_vars,
                       indent=2)

        except Exception as err:
            inform("Couldn't import NEST into Python: ", err, indent=1)
            inform("NEST env vars: %s" % PyNestEngine.environment_vars,
                   indent=1)
            ret = False
        return ret
    def run(self):


        try:
            self.stdout = PyNRNEngine.compile_modfiles(self.modelpath)
        except sp.CalledProcessError as err:
            self.stderr = err.output
            self.returncode = err.returncode
            inform('Error compiling modfiles:', self.stderr, indent=2)

        try:            
            inform("Running file %s with %s" % (trim_path(self.modelpath), self.name), indent=1)
            self.stdout = check_output(['mpiexec','-np','4','nrniv','-mpi', self.modelpath, '-nogui'],
                                          cwd=os.path.dirname(self.modelpath))
            self.returncode = 0
        except sp.CalledProcessError as err:
            self.returncode = err.returncode
            self.stdout = err.output
            raise EngineExecutionError
        except Exception as err:
            inform("Another error with running %s: "%self.name, err, indent=1)
            self.returncode = -1
            self.stdout = "???"
    def run_using_jnmlnrn_env(engine, modelpath, args):

        try:
            env = JNeuroMLNRNEngine.get_jnmlnrnenv()
            inform("Running file %s with %s, env: %s" %
                   (trim_path(modelpath), engine, env),
                   indent=1)
            from omv.engines.jneuroml import JNeuroMLEngine
            jnml = JNeuroMLEngine.get_executable()
            cmds = [jnml, modelpath]
            cmds.extend(args)
            stdout = check_output(cmds,
                                  cwd=os.path.dirname(modelpath),
                                  env=env)

            inform("Success with running ", engine, indent=1)
            returncode = 0
            return stdout, returncode
        except sp.CalledProcessError as err:
            inform("Error with ", engine, indent=1)
            returncode = err.returncode
            stdout = err.output
            return stdout, returncode
示例#40
0
def install_moose():
    install_root = os.environ['HOME']

    with working_dir(install_root):
        print(
            check_output(
                ['git', 'clone',
                 'https://github.com/pgleeson/moose-core.git']))

    with working_dir(os.path.join(install_root, 'moose-core')):
        print(check_output(['mkdir', 'build_']))

    with working_dir(os.path.join(install_root, 'moose-core/build_')):
        print(check_output(['cmake', '..']))
        print(check_output(['make', '-j4']))
        print(check_output(['make', 'install']))

    with working_dir(os.path.join(install_root, 'moose-core/build_/python')):
        print(check_output(['pwd']))
        print(check_output(['python', 'setup.py', 'install']))

    m = 'Successfully installed Moose...'
示例#41
0
 def run(self):
     try:
         path_s = resolve_paths(self.modelpath)
             
         from omv.engines.jneuroml import JNeuroMLEngine
         jnml = JNeuroMLEngine.get_executable()
         cmds = [jnml, '-validate']
         for p in path_s: cmds.append(p)
         
         inform("Running with %s, using %s..." % (JNeuroMLValidateEngine.name,
                cmds),
                indent=1)
         self.stdout = check_output(cmds,
             cwd=os.path.dirname(self.modelpath),
             env=JNeuroMLEngine.get_environment())
         inform("Success with running ", JNeuroMLValidateEngine.name,
                indent=1, verbosity=1)
         self.returncode = 0
     except sp.CalledProcessError as err:
         inform("Error with ",  JNeuroMLValidateEngine.name,
                indent=1, verbosity=1)
         self.returncode = err.returncode
         self.stdout = err.output
         raise EngineExecutionError
def install_pynn():
    try:
        
        pip.main(['install', 'lazyarray'])  # This should ideally be automatically installed with PyNN...
        pip.main(['install', 'neo==0.5.1'])  # This should ideally be automatically installed with PyNN...

        install_root = os.environ['HOME']

        with working_dir(install_root):
            check_output(['git', 'clone', 'https://github.com/NeuralEnsemble/PyNN.git'])

        path = os.path.join(install_root,'PyNN')

        with working_dir(path):
            check_output(['git','checkout','tags/0.9.2'])
            #check_output(['git','checkout','master'])
            check_output(['python', 'setup.py', 'install'])
        import pyNN
        m = 'Successfully installed pyNN...'
    except Exception as e:
        m = 'ERROR installing pyNN: ' + str(e)
    finally:
        inform(m)
def install_nest(version):
    
    if not version:
        version='2.12.0'
        
    inform('Installing NEST', indent=2, verbosity=1)
    nestpath = os.path.join(os.environ['HOME'],'nest')
    nestpath2 = os.path.join(os.environ['HOME'],'nest/nest')
    nestinstallpath = os.path.join(os.environ['HOME'],'nest/nest')
    if 'NEST_INSTALL_DIR' in os.environ:
            nestinstallpath = os.environ['NEST_INSTALL_DIR']+'/'
            
    inform('Installing NEST (src: %s), (tgt: %s)'%(nestpath, nestinstallpath), indent=2, verbosity=1)
    os.mkdir(nestpath)
    
    with working_dir(nestpath):
        #version='2.10.0'
        check_output(['wget', 'https://github.com/nest/nest-simulator/archive/v%s.tar.gz'%(version)])
        
        check_output(['tar', 'xzvf', 'v%s.tar.gz'%version])
        check_output(['mv', 'nest-simulator-%s'%version, 'nest'], cwd=nestpath)
            
    with working_dir(nestpath2):
        check_output(["cmake", "-DCMAKE_INSTALL_PREFIX:PATH=%s"%(nestinstallpath)])
        check_output(['make'])
        check_output(['make', 'install'])
def install_nest(version):
    
    if not version:
        version='2.18.0'
        
    inform('Installing NEST', indent=2, verbosity=1)
    nestpath = os.path.join(os.environ['HOME'],'nest')
    nestpath2 = os.path.join(os.environ['HOME'],'nest/nest')
    nestinstallpath = os.path.join(os.environ['HOME'],'nest/nest')
    if 'NEST_INSTALL_DIR' in os.environ:
            nestinstallpath = os.environ['NEST_INSTALL_DIR']+'/'
            
    inform('Installing NEST (src: %s), (tgt: %s)'%(nestpath, nestinstallpath), indent=2, verbosity=1)
    os.mkdir(nestpath)
    
    with working_dir(nestpath):
        #version='2.10.0'
        check_output(['wget', 'https://github.com/nest/nest-simulator/archive/v%s.tar.gz'%(version)])
        
        check_output(['tar', 'xzvf', 'v%s.tar.gz'%version])
        check_output(['mv', 'nest-simulator-%s'%version, 'nest'], cwd=nestpath)
            
    with working_dir(nestpath2):
        check_output(["cmake", "-DCMAKE_INSTALL_PREFIX:PATH=%s"%(nestinstallpath)])
        check_output(['make','-j4'])
        check_output(['make', 'install'])
示例#45
0
def install_octave():

    inform('Installing Octave', indent=2, verbosity=1)

    check_output(['apt-get', 'install', 'octave'])