-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathgetnrn.py
More file actions
59 lines (50 loc) · 1.93 KB
/
getnrn.py
File metadata and controls
59 lines (50 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
import sys
from subprocess import check_output as co
from omv.common.inout import inform
from omv.common.inout import pip_install
from omv.engines.utils.wdir import working_dir
def install_neuron(version):
if not version:
if sys.version_info.major == 3:
version = "8.2.6" # for pynn 0.11.0
else:
version = "7.6"
if sys.version_info.major == 3 and ("7.8" in version or "8." in version):
pip_install("neuron==%s" % version)
import neuron
inform("Successfully installed NEURON v%s using pip.." % version, indent=2)
else:
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):
nrn_url = (
"https://www.neuron.yale.edu/ftp/neuron/versions/v%s/nrn-%s.tar.gz"
% (version, version)
)
dl_file = "nrn-%s.tar.gz" % version
# See below re 7.8 on py2...
if "7.8" in version or "8.0" in version:
nrn_url = "https://github.com/neuronsimulator/nrn/archive/%s.tar.gz" % (
version
)
dl_file = "%s.tar.gz" % version
print(co(["wget", "-nv", nrn_url]))
print(co(["tar", "xzvf", dl_file]))
print(co(["mv", "nrn-%s" % version, "nrn"]))
os.chdir("nrn")
path = os.getcwd()
pyexec = sys.executable
# Needs to be updated if Neuron >=7.8...
co(
[
"./configure --prefix=%s --without-iv --with-nrnpython=%s"
% (path, pyexec)
],
shell=True,
)
print(co(["make", "-j3"]))
print(co(["make", "install"]))
os.chdir("src/nrnpython")
print(co(["pip", "install", "."]))