xiaoqiugood的个人博客分享 http://blog.sciencenet.cn/u/xiaoqiugood

博文

再谈Phonopy的安装:学而时习之 python3.6 setup.py install

已有 17455 次阅读 2016-12-25 16:32 |个人分类:软件安装及编译|系统分类:科研笔记

关注:

1) 有些软件的安装需时刻掌握,有时服务器不一定能提供你所需的软件服务

2) 从软件安装看软件运行过程


在Ubuntu下安装更容易进行



http://atztogo.github.io/phonopy/



摘录学习:

Linux下安装Phonopy



http://blog.sina.com.cn/s/blog_86e874d30102vvdd.html



折腾了好久,终于成功安装上了Phonopy,记录一下经验,供大家参考:
首先说一下我已有的编译环境:
1.用cat /proc/version指令查到的Linux内核版本:Linux version 2.6.32 (Red Hat 4.4.7-4)
2.服务器正常联网,这是为了保证在安装matplotlib的时候可以联网找到需要的库。
3.gcc/icc编译器已经安装好。

下面是安装步骤:


1. Install python

https://www.python.org/downloads/

https://sourceforge.net/projects/matplotlib/?source=typ_redirect



a) download python 2.7.8
b) unzip Python-2.7.8.tgz and change to folder Python-2.7.8
c) ./configure --prefix=/home/user/USERPATH/Python-2.7.8
d) make
e) make install
f) Revise .bash_profile, add the following line to it

  export PYTHONPATH=$HOME/USERPATH/Python-2.7.8

export PATH=/db/home/yexq/software/gnuplot465/bin:/db/home/yexq/software/Python-3.6.0/bin:/db/home/yexq/software/vtstscripts-898:$PATH


g) Add the path of USERPATH/Python-2.7.8/bin/python to the environment variable.

2. Install Numpy

https://pypi.python.org/pypi/numpy/1.8.2

https://sourceforge.net/projects/numpy/postdownload?source=dlp

https://sourceforge.net/projects/numpy/?source=typ_redirect

a) download numpy-1.8.2.tar.gz, unzip it and change to the folder
b) python2.7 setup.py build
c) python2.7 setup.py install

3. Install Matplotlib

https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.tar.gz/download

http://matplotlib.org/downloads.html

https://sourceforge.net/projects/matplotlib/?source=typ_redirect

 

a) download matplotlib-1.3.1.tar.gz, unzip it and change to the folder
b) python2.7 setup.py install

c) it will automatically download distribute-0.6.28.tar.gz, if it's unable to download, we can download manually and put it in the folder.

PS:依赖包很多,且很多均不能自动下载,需要手动下载。


4. Install lxml

https://pypi.python.org/pypi/lxml/3.4.3

a) download lxml-3.4.3.tar.gz, unzip it and change to the folder
b) python2.7 setup.py install


PS:安装成功后显示:Installed /db/home/yexq/software/Python-3.6.0/lib/python3.6/site-packages/lxml-3.4.1-py3.6-linux-x86_64.egg
Processing dependencies for lxml==3.4.1
Finished processing dependencies for lxml==3.4.1

5. Install PyYAML

http://www.pyyaml.org/download/pyyaml/


a) download PyYAML-3.11.tar.gz, unzip it and change to the folder

b) python2.7 setup.py install


PS:安装成功后显示 Writing /db/home/yexq/software/Python-3.6.0/lib/python3.6/site-packages/PyYAML-3.11-py3.6.egg-info


6. Install Phonopy

https://atztogo.github.io/phonopy/

https://sourceforge.net/projects/phonopy/files/latest/download



a) download phonopy-1.9.2-rc5.tar.gz, unzip it and change to the folder


b) python2.7 setup.py install --home=/home/user/USERPATH/phonopy


PS:  python3.6 setup.py install   --home=/db/home/yexq/software/phonopy184

phonopy184为新建的一目录,安装成功后显示


running install_egg_info
Writing /db/home/yexq/software/phonopy184/lib/python/phonopy-1.8.4-py3.6.e



错误收集:

Python-2.6

http://blog.csdn.net/njuitjf/article/details/6566902



Failed to find the necessary bits to build these modules:
_curses            _curses_panel      _hashlib        
_sqlite3           _ssl               _tkinter        
bsddb185           dl                 imageop        
readline           sunaudiodev                        
To find the necessary bits, look in setup.py in detect_modules() for the module's name.



大致原因如下:

 This is not related to PEP 3149 failures.  Ubuntu 11.04 introduced multiarch
   directories for the underlying shared libraries used to link to the Python
   extension modules.  Unpatched, Python's setup.py does not add the necessary
   multiarch directories to the search paths, so some extensions won't build.

  Ubuntu 11.04's Python packages have been patched to add the correct search
   paths.  Upstream Python 2.7, 3.1, 3.2, and 3.3 have also been patched to
   include the correct search paths, but fixed versions have not been released
   upstream yet.  Python 2.6 won't be patched.

  See issue 11715 for details.


找到了病根,也就好对症下药。拿Python-2.7.2试试,果然OK。


官网解读:

http://atztogo.github.io/phonopy/install.html

System requirement

  The procedure to setup phonopy is explained in this section. It is supposed that phonopy is installed on the recent linux distribution like Ubuntu or Fedora with Python version 2.6 or later. Python version 3.4 or later is expected to work.

  Mac OS X users may find some more information at Using phonopy on Mac OS X.


The most recommended system is Ubuntu linux version 14.04 or later. If you have any installation problem that you may feel difficult to solve, please use a ubuntu virtual machine (see Set up Ubuntu linux on VirtualBox).

Prepare the following Python libraries:

  • Python and its header files

  • numpy

  • matplotlib

  • python-yaml (pyyaml)

  • python-h5py (h5py)

In Ubuntu linux, they are installed by:

%sudoapt-getinstallpython-devpython-numpy \  python-matplotlibpython-yamlpython-h5py

python-scipy is also required to use phonopy-qha or DEBYE_MODEL tag.



The python libraries are also possible to be installed using pip or conda.

The texlive-fonts-recommended package may be required, if you see the following message in ploting results:

! I can't find file `pncr7t'.
Install using pip/conda

Occasionally PyPI and conda packages are prepared at phonopy releases. Using these packages, the phonopy installtion is expected to be easily done.

Using pip

Numpy is required before the python-spglib installation. The command to install spglib is:

%pip install phonopy

If you see the error message like below in the installation process:

_phonopy.c:35:20:fatalerror:Python.h:Nosuchfileordirectory

development tools for building python module are additionally necessary and are installed using OS’s package management system, e.g.,:

sudo apt-get install python-dev
Using conda

Conda is another choice for Linux (64bit) users:

%conda install -c atztogo phonopy

Currently conda packages for the other OS, e.g., Mac and windows, are not prepared by the main developers of phonopy.

Building using setup.py

If package installation is not possible or you want to compile with special compiler or special options, phonopy is built using setup.py. In this case, manual modification of setup.py may be needed.

  1. Download the source code at

    https://pypi.python.org/pypi/phonopy

    and extract it:

    %tar xvfz phonopy-1.11.2.tar.gz
  2. Set up C-libraries for python C-API and python codes. This can be done as follows:

    Run setup.py script:

    %python setup.py install--home=<my-directory>

    where <my-directory> may be your current directory, .. Another choice may be to use the user scheme (see the python document):

    %python setup.py install  --user

    The executable command phonopy is located in the bin directory.

  3. Put lib/python path into $PYTHONPATH, e.g., in your .bashrc, .zshenv, etc. If it is installed under your current directory, the path to be added to $PYTHONPATH is such as below:

    export PYTHONPATH=~/phonopy-1.11.2/lib/python
Tips on setup.py installation


http://blog.csdn.net/npy_lp/article/details/42080553

Ubuntu操作系统中,使用apt-get命令安装所需的开发软件非常方便,但也有不少时候由于链接不上软件源而不能正常安装,于是很多人都会想到使用sudo apt-get update命令来更新软件源,而恰恰这时屋漏偏逢连夜雨,更新命令也不能正常工作,出现大量“Failed to fetch”的错误。

其实,解决这个问题十分简单,只要设置妥当DNS服务器即可,如电信网络的设置如下所示。

[plain] view plain copy
在CODE上查看代码片派生到我的代码片
  1. $ sudo vi /etc/resolv.conf  

  2.  

   

   再次执行sudo apt-get update命令,结果一切正常。



在Ubuntu下安装

http://atztogo.github.io/phonopy/install.html#id6

Building using setup.py

If package installation is not possible or you want to compile with special compiler or special options, phonopy is built using setup.py. In this case, manual modification ofsetup.py may be needed.

  1. Download the source code at

    https://pypi.python.org/pypi/phonopy

    and extract it:

    %tarxvfzphonopy-1.11.2.tar.gz
  2. Set up C-libraries for python C-API and python codes. This can be done as follows:

    Run setup.py script:

    %pythonsetup.pyinstall--home=<my-directory>

    where <my-directory> may be your current directory, .. Another choice may be to use the user scheme (see the python document):

    %pythonsetup.pyinstall--user  【测试可行】

    The executable command phonopy is located in the bin directory.

  3. Put lib/python path into $PYTHONPATH, e.g., in your .bashrc, .zshenv, etc. If it is installed under your current directory, the path to be added to $PYTHONPATH is such as below:

    exportPYTHONPATH=~/phonopy-1.11.2/lib/python




执行

pythonsetup.pyinstall--user

安装成功后,显示....

Installing phonopy script to /home/xiaoqiu/.local/bin

Installing phonopy-qha script to /home/xiaoqiu/.local/bin

Installing gruneisen script to /home/xiaoqiu/.local/bin

Installing outcar-born script to /home/xiaoqiu/.local/bin

Installing dispmanager script to /home/xiaoqiu/.local/bin

Installing propplot script to /home/xiaoqiu/.local/bin


Installed /home/xiaoqiu/.local/lib/python2.7/site-packages/phonopy-1.11.8-py2.7-linux-x86_64.egg  【egg什么意思】

Processing dependencies for phonopy==1.11.8

Searching for h5py==2.6.0

Best match: h5py 2.6.0

Adding h5py 2.6.0 to easy-install.pth file


Using /usr/lib/python2.7/dist-packages

Searching for matplotlib==1.5.1

Best match: matplotlib 1.5.1

matplotlib 1.5.1 is already the active version in easy-install.pth


Using /usr/lib/python2.7/dist-packages

Searching for PyYAML==3.11

Best match: PyYAML 3.11

PyYAML 3.11 is already the active version in easy-install.pth


Using /usr/lib/python2.7/dist-packages

Searching for numpy==1.11.0

Best match: numpy 1.11.0

numpy 1.11.0 is already the active version in easy-install.pth


Using /usr/lib/python2.7/dist-packages

Finished processing dependencies for phonopy==1.11.8



export PYTHONPATH=~/phonopy-1.11.2/lib/python



export PYTHONPATH=/home/xiaoqiu/Downloads/phonopy-1.11.8/lib/python




https://wap.sciencenet.cn/blog-567091-1023204.html

上一篇:加SOC对晶格参数的影响
下一篇:虚拟机与主机之间的数据传输再谈
收藏 IP: 118.117.2.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (2 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-23 10:31

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部