推荐使用Anaconda 或者pip安装
Nipype安装
1、创建一个名为nipype
的虚拟环境
conda create -n nipypes python=3.8
激活虚拟环境
conda activate nipypes
2、安装nipype包
conda方式
conda search nipype --channel conda-forge
conda install --channel conda-forge nipype
pip方式
pip install nipype
3、安装其他的依赖包
这一步很容易出错,pygraphviz
和graphviz
这两个包特别不好装
对于Ubuntu用户
#Install packages with pip
pip install nibabel rdflib nipy dipy
#Install graphviz and pygraphviz separately
sudo apt-get install graphviz libgraphviz-dev
pip install --upgrade pygraphviz graphviz
对于CentOS的用户
如果出现pip install pygraphviz: No package 'libcgraph' found
的错误,可以参考下面这个,不一定有用!
- yum list available graphviz*
- select the appropriate package
- sudo yum install ‘graphviz-devel.x86_64’
- pip install pygraphviz
如果无效的话参考我的Ref.2或者Google或者在GitHub issue里看能不能找到
检测是否安装成功
在创建的虚拟环境中:
先安装pytest库
pip install pytest
测试
python -c "import nipype; print(nipype.__version__)"
python -c "import nipype; nipype.test()"
发现报错
=========================== short test summary info ============================
ERROR anaconda3/envs/nipypes/lib/python3.8/site-packages/nipype/sphinxext/apidoc/__init__.py
ERROR anaconda3/envs/nipypes/lib/python3.8/site-packages/nipype/sphinxext/apidoc/docstring.py
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
======================== 16 warnings, 2 errors in 9.72s ========================
找到错误原因:
==================================== ERRORS ====================================
________________ ERROR collecting sphinxext/apidoc/__init__.py _________________
anaconda3/envs/nipypes/lib/python3.8/site-packages/nipype/sphinxext/apidoc/__init__.py:5: in <module>
from sphinxcontrib.napoleon import (
E ModuleNotFoundError: No module named 'sphinxcontrib.napoleon'
________________ ERROR collecting sphinxext/apidoc/docstring.py ________________
anaconda3/envs/nipypes/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
???
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
<frozen importlib._bootstrap>:1014: in _gcd_import
???
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:671: in _load_unlocked
???
<frozen importlib._bootstrap_external>:783: in exec_module
???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
???
anaconda3/envs/nipypes/lib/python3.8/site-packages/nipype/sphinxext/apidoc/__init__.py:5: in <module>
from sphinxcontrib.napoleon import (
E ModuleNotFoundError: No module named 'sphinxcontrib.napoleon'
=============================== warnings summary ===============================
安装sphinxcontrib-napoleon
这个包
pip install sphinxcontrib-napoleon
pip install -U Sphinx
Reference
http://miykael.github.io/nipype-beginner-s-guide/installation.html#ants
https://stackoverflow.com/questions/40528048/pip-install-pygraphviz-no-package-libcgraph-found