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_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 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_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'])
def install_nml2(): with working_dir(install_root): print(co(['git', 'clone', 'https://github.com/NeuroML/NeuroML2.git'])) with working_dir(default_nml2_dir): print(co(['git', 'checkout', 'development'])) inform('Successfully cloned NeuroML2', indent=2, verbosity=1)
def install_nml2(): with working_dir(install_root): print(co(['git', 'clone', 'https://github.com/NeuroML/NeuroML2.git'])) with working_dir(default_nml2_dir): print(co(['git', 'checkout', 'development'])) inform('Successfully cloned NeuroML2', indent=2, verbosity=1)
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_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_jlems(): install_root = os.environ['HOME'] with working_dir(install_root): print(co(['git', 'clone', 'https://github.com/LEMS/jLEMS.git'])) inform('Successfully cloned jLEMS', indent=2, verbosity=1) path = os.path.join(install_root,'jLEMS') with working_dir(path): print(co(['git', 'checkout', 'development'])) print(co(['mvn', 'install'])) inform('Successfully installed jLEMS', indent=2, verbosity=1)
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)
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 install_jlems(): install_root = os.environ['HOME'] with working_dir(install_root): print(co(['git', 'clone', 'https://github.com/LEMS/jLEMS.git'])) inform('Successfully cloned jLEMS', indent=2, verbosity=1) path = os.path.join(install_root, 'jLEMS') with working_dir(path): print(co(['git', 'checkout', 'development'])) print(co(['mvn', 'install'])) inform('Successfully installed jLEMS', indent=2, verbosity=1)
def install_neuron(version): if not version: version = '7.6' nrnpath = os.path.join(os.environ['HOME'], 'neuron') inform('Installing NEURON %s into %s' % (version, nrnpath), indent=1) os.mkdir(nrnpath) with working_dir(nrnpath): print( co([ 'wget', 'https://www.neuron.yale.edu/ftp/neuron/versions/v%s/nrn-%s.tar.gz' % (version, version) ])) print(co(['tar', 'xzvf', 'nrn-%s.tar.gz' % version])) print(co(['mv', 'nrn-%s' % version, 'nrn'])) os.chdir('nrn') path = os.getcwd() pyexec = sys.executable co([ "./configure --prefix=%s --without-iv --with-nrnpython=%s" % (path, pyexec) ], shell=True) print(co(['make', '-j4'])) print(co(['make', 'install'])) os.chdir('src/nrnpython') run_setup('./setup.py', ['install'])
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
def run(self): try: self.stdout = NeuronEngine.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) with working_dir(dirname(self.modelpath)): inform("Running %s on %s..." % (self.name, self.modelpath), indent=1) p = sp.Popen(['nrniv', '-python', self.modelpath, '-nogui'], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) cmd = '''\ %s ''' % ('\n'.join(self.extra_pars)) stdout, stderr = p.communicate(dedent(cmd)) # with open('/tmp/omv_test.nrn.stdout', 'w') as f: # f.write(stdout) self.stdout = stdout self.stderr = stderr inform("OUT: ", stdout, verbosity=1, indent=2) inform("ERR: ", stderr, verbosity=1, indent=2) inform("returncode: ", p.returncode, verbosity=1, indent=2) self.returncode = p.returncode if self.returncode is not 0: raise EngineExecutionError
def run(self): try: self.stdout = self.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) with working_dir(dirname(self.modelpath)): inform("Running %s on %s..." % (self.name, self.modelpath), indent=1) p = sp.Popen(['nrniv'], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) cmd = '''\ load_file("noload.hoc") //cvode_active(1) load_file("%s") %s ''' % (self.modelpath, '\n'.join(self.extra_pars)) stdout, stderr = p.communicate(dedent(cmd)) # with open('/tmp/omv_test.nrn.stdout', 'w') as f: # f.write(stdout) self.stdout = stdout self.stderr = stderr inform("OUT: ", stdout, verbosity=1, indent=2) inform("ERR: ", stderr, verbosity=1, indent=2) inform("returncode: ", p.returncode, verbosity=1, indent=2) self.returncode = p.returncode if self.returncode is not 0: raise EngineExecutionError
def run(self): try: self.stdout = NeuronEngine.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) with working_dir(dirname(self.modelpath)): inform("Running %s on %s..." % (self.name, self.modelpath), indent=1) p = sp.Popen(['nrniv', '-python', self.modelpath, '-nogui'], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) cmd = '''\ %s ''' % ('\n'.join(self.extra_pars)) if sys.version_info[0]==3: c = dedent(cmd).encode() else: c = dedent(cmd) stdout, stderr = p.communicate(c) # with open('/tmp/omv_test.nrn.stdout', 'w') as f: # f.write(stdout) self.stdout = str(stdout.decode()) self.stderr = str(stderr.decode()) inform("OUT: %s"% self.stdout, verbosity=1, indent=2) inform("ERR: %s"% self.stderr, verbosity=1, indent=2) inform("returncode: [%s]"% p.returncode, verbosity=1, indent=2) self.returncode = p.returncode if self.returncode != 0: raise EngineExecutionError
def install_jnml(): jnmlpath = os.path.join(os.environ['HOME'], 'jnml') os.mkdir(jnmlpath) with working_dir(jnmlpath): print( co([ 'svn', 'checkout', 'https://svn.code.sf.net/p/neuroml/code/jNeuroMLJar' ]))
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...'
def is_installed(version): inform('Checking whether neuroConstruct is installed', indent=2) ret = True try: with working_dir(PyneuroConstructEngine.get_nC_environment()['NC_HOME']): print(co(['./nC.sh','-v'])) except Exception as err: inform("Couldn't execute neuroConstruct:", err, indent=1) ret = False return ret
def install_neuroconstruct(): try: install_root = os.environ['HOME'] with working_dir(install_root): print(co(['git', 'clone', 'https://github.com/NeuralEnsemble/neuroConstruct.git'])) path = os.path.join(install_root,'neuroConstruct') with working_dir(path): print(co(['./updatenC.sh'])) print(co(['./nC.sh', '-make'])) m = 'Successfully installed neuroConstruct...' except Exception as e: m = 'ERROR installing neuroConstruct: ' + str(e) finally: inform(m)
def is_installed(version): inform('Checking whether neuroConstruct is installed', indent=2, verbosity=2) ret = True try: with working_dir(PyneuroConstructEngine.get_nC_environment()['NC_HOME']): r = co(['./nC.sh','-v'], verbosity=1) ret = 'v%s'%r.split()[-1] except Exception as err: inform("Couldn't execute neuroConstruct:", err, indent=1) ret = False return ret
def install_genesis(get_latest=False): genpath = os.path.join(os.environ['HOME'], 'genesis') os.mkdir(genpath) with working_dir(genpath): print(co(['wget', 'https://github.com/borismarin/genesis2.4gamma/archive/master.zip'])) print(co(['unzip', 'master.zip'])) print(co(['ls', '-la', 'genesis2.4gamma-master'])) os.chdir('genesis2.4gamma-master/src') print(co(['./configure'])) print(co(['make'])) open(os.path.join(os.environ['HOME'], '.simrc'), 'w').write(simrc)
def is_installed(version): nChome = PyneuroConstructEngine.get_nC_environment()['NC_HOME'] inform('Checking whether neuroConstruct is installed (in %s)'%nChome, indent=2, verbosity=2) ret = True try: with working_dir(nChome): r = co(['./nC.sh','-v'], verbosity=1) ret = 'v%s'%r.split('neuroConstruct, version: ')[-1].split()[0] except Exception as err: inform("Couldn't execute neuroConstruct:", 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', '-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...'
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_neuroconstruct(): try: install_root = os.environ['HOME'] with working_dir(install_root): print( co([ 'git', 'clone', 'https://github.com/NeuralEnsemble/neuroConstruct.git' ])) path = os.path.join(install_root, 'neuroConstruct') with working_dir(path): print(co(['./updatenC.sh'])) print(co(['./nC.sh', '-make'])) m = 'Successfully installed neuroConstruct...' except Exception as e: m = 'ERROR installing neuroConstruct: ' + str(e) finally: inform(m)
def install_genesis(get_latest=False): genpath = os.path.join(os.environ['HOME'], 'genesis') os.mkdir(genpath) with working_dir(genpath): print( co([ 'wget', 'https://github.com/borismarin/genesis2.4gamma/archive/master.zip' ])) print(co(['unzip', 'master.zip'])) print(co(['ls', '-la', 'genesis2.4gamma-master'])) os.chdir('genesis2.4gamma-master/src') print(co(['./configure'])) print(co(['make'])) open(os.path.join(os.environ['HOME'], '.simrc'), 'w').write(simrc)
def install_jnml(): version = '0.10.1' jnmlpath = os.path.join(os.environ['HOME'], 'jnml') if not os.path.isdir(jnmlpath): os.mkdir(jnmlpath) with working_dir(jnmlpath): check_output([ 'wget', 'https://github.com/NeuroML/jNeuroML/releases/download/v%s/jNeuroML.zip' % (version) ]) check_output(['unzip', 'jNeuroML.zip'])
def run(self): from pkg_resources import resource_filename with working_dir(os.path.dirname(self.modelpath)): try: temp = NamedTemporaryFile(suffix='.g') temp.write('include %s\n' % self.modelpath) temp.write('include %s\n' % resource_filename('omv', 'engines/utils/genesis_utils.g')) temp.write('\n'.join(self.extra_pars) + '\n') temp.seek(0) with open('/tmp/omv.gen.err', 'w+') as se: self.stdout = sp.check_output(['genesis', '-nox', '-batch', '-notty', temp.name], stderr=se) se.seek(0) self.stderr = se.readlines() self.returncode = 0 except sp.CalledProcessError as e: self.returncode = e.returncode raise EngineExecutionError finally: temp.close()
def install_neuron(get_latest=False): nrnpath = os.path.join(os.environ['HOME'],'neuron') inform('Installing NEURON into %s'%nrnpath, indent=1) os.mkdir(nrnpath) with working_dir(nrnpath): if get_latest: print(co(['git', 'clone', 'https://github.com/neuronsimulator/nrn'])) os.chdir('nrn') print(co(['./build.sh'])) else: print(co(['wget', 'https://www.neuron.yale.edu/ftp/neuron/versions/v7.4/nrn-7.4.tar.gz'])) print(co(['tar', 'xzvf', 'nrn-7.4.tar.gz'])) print(co(['mv', 'nrn-7.4', 'nrn'])) os.chdir('nrn') path = os.getcwd() pyexec = 'python2' #sys.executable co(["./configure --prefix=%s --without-iv --without-paranrn --with-nrnpython=%s"%(path,pyexec)], shell=True) print(co(['make'])) print(co(['make', 'install'])) os.chdir('src/nrnpython') run_setup('./setup.py', ['install'])
def run(self): from pkg_resources import resource_filename with working_dir(os.path.dirname(self.modelpath)): try: temp = NamedTemporaryFile(suffix='.g') temp.write('include %s\n' % self.modelpath) temp.write( 'include %s\n' % resource_filename('omv', 'engines/utils/genesis_utils.g')) temp.write('\n'.join(self.extra_pars) + '\n') temp.seek(0) with open('/tmp/omv.gen.err', 'w+') as se: self.stdout = sp.check_output( ['genesis', '-nox', '-batch', '-notty', temp.name], stderr=se) se.seek(0) self.stderr = se.readlines() self.returncode = 0 except sp.CalledProcessError as e: self.returncode = e.returncode raise EngineExecutionError finally: temp.close()
raw_url = github_repo.link_to_raw_file_in_repo(".travis.yml") print(" .travis.yml found at %s\n" % raw_url) contents = osb.utils.get_page(raw_url) if 'omv' not in contents: print("That .travis.yml does not look like it uses OMV...") non_omv_tests += 1 else: testable_projects += 1 test_it = True else: print(" (No .travis.yml)") if test_it: target_dir = '%s/%s' % (test_dir, proj_id) print co(['git', 'clone', str(github_repo.clone_url), target_dir]) with working_dir(target_dir): if proj_id in branches.keys(): print co(['git', 'checkout', branches[proj_id]]) print "Running 'omv all' on", target_dir test_all() passing_projects += 1 print("\nSo far: %i projects with OMV tests which pass\n" % (passing_projects)) end = datetime.datetime.now() print("\n%i projects checked, of which %i have OMV tests (%i non-OMV tested projects) and %i passed with OMV in %s seconds\n" % (projects, testable_projects, non_omv_tests, passing_projects, (end - start).seconds))
contents = osb.utils.get_page(raw_url) if 'omv' not in contents: print("That .travis.yml does not look like it uses OMV...") non_omv_tests += 1 else: testable_projects += 1 test_it = True else: print(" (No .travis.yml)") if test_it: target_dir = '%s/%s' % (test_dir, proj_id) print co(['git', 'clone', str(github_repo.clone_url), target_dir]) with working_dir(target_dir): if proj_id in branches.keys(): print co(['git', 'checkout', branches[proj_id]]) print "Running 'omv all' on", target_dir test_all() passing_projects += 1 print("\nSo far: %i projects with OMV tests which pass\n" % (passing_projects)) end = datetime.datetime.now() print( "\n%i projects checked, of which %i have OMV tests (%i non-OMV tested projects) and %i passed with OMV in %s seconds\n" % (projects, testable_projects, non_omv_tests, passing_projects, (end - start).seconds))
def install_jnml(): jnmlpath = os.path.join(os.environ['HOME'],'jnml') os.mkdir(jnmlpath) with working_dir(jnmlpath): print(co(['svn', 'checkout', 'https://svn.code.sf.net/p/neuroml/code/jNeuroMLJar']))