基于ubuntu 22.04环境安装NEURON仿真器
目录
1.生成新的docker容器
2.容器中安装
(1)安装依赖
(2)安装neuron
(3)源码安装
**遇到了下载过慢的问题
(4)安装NEURON仿真器
(5)编译
(6)测试
源码:https://github.com/neuronsimulator/nrn
论坛:www.neuron.yale.edu - Index page
官方安装链接:Installing Binary Distribution — NEURON documentation
因为我是在容器中配置的环境,所以没有用到sudo权限,如果是自己的机器的话,需要用
1.生成新的docker容器
docker run -it ubuntu:latest /bin/bash
生成的新容器名:
2.容器中安装
(1)安装依赖
pip缺失
先更新:
apt update
apt install python3 python3-pip
验证:
安装包
apt-get install -y bison cmake flex git \libncurses-dev libopenmpi-dev libx11-dev \libxcomposite-dev openmpi-bin python3-dev
pip install scipy numpy cython
(2)安装neuron
(3)源码安装
git clone https://github.com/neuronsimulator/nrn
我下载的时候速度只有60kB/s,可能是镜像源的问题,修改一下镜像源再试试。
**遇到了下载过慢的问题
修改镜像源
清华大学镜像网站:ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
查看ubuntu版本:
lsb_release -a
如果提示bash: lsb_release: command not found,则使用apt install lsb-release安装lsb_release。
查看源:cat /etc/apt/sources.list
备份源:sudo cp /etc/apt/sources.list /etc/apt/sources.list.back
修改sources.list文件:vim /etc/apt/sources.list
按照版本粘贴内容:
更新:
apt-get update
实际更换后并没有什么用,所以最后使用了gitee中的版本下载链接。
git clone https://gitee.com/TiffanytorinoHe/nrn.git
(4)安装NEURON仿真器
然后下载完成后提示一个新的目录nrn/,执行:
cd nrn/
pip install -r nrn_requirements.txt
其中会下载nrn_requirements.txt中需要的依赖项,时间大概3-5分钟。
cmake .. \-DNRN_ENABLE_INTERVIEWS=OFF \-DNRN_ENABLE_MPI=OFF \-DNRN_ENABLE_RX3D=OFF \-DPYTHON_EXECUTABLE=$(which python3)
(5)编译
然后在build目录中编译:
cmake --build . --parallel 8 --target install
导入系统路径:
export PATH=/path/to/install/directory/bin:$PATH
export PYTHONPATH=/path/to/install/directory/lib/python:$PYTHONPATH
(6)测试
python
import neuron
print(neuron.__version__)