2. Installing the phaseshifts package
2.1. TDLR;
For python 3.11 or older:
pip install wheel numpy setuptools
# latest pypi release
pip install phaseshifts
# or local version with essential packages for development
git clone https://github.com/Liam-Deacon/phaseshifts
cd phaseshifts
pip install -e .[dev,test] # !! best do this in a virtualenv
phsh --help
2.2. Details
The phaseshifts package requires CPython 2.7 or later and also uses the numpy, scipy and periodictable packages. Currently, it has only been tested extensively with Python 2.7 on Windows, so there are no guarantees with other platforms. To perform a setup follow the steps below.
Install the numpy, scipy and periodictable packages.
On systems compatible with PyPI this can be done using the command:
pip install numpy scipy periodictableOr if you have the easy_install package:
easy_install install numpy scipy periodictableOlder versions of
numpy
&scipy
did not allow simultaneous installation - if you experience problems then try first installing numpy before attempting to install scipy.The
periodictable
package allows lookup of the most common crystal structure for a given element and is instrumental in many of the convenience functions contained in the model module.Alternatively download and install these packages manually following the instructions provided for the respective packages.
To install the phaseshifts package:
pip install phaseshiftsNote
Until a
pyproject.toml
with a working PEP-517 build backend is implemented then the user will first need to runpip install numpy setuptools wheel
in order to have the necessary python pre-requisites available (along with a fortran compiler) in order to compile the FORTRAN source and wrap it to be available via python.Tip
Running
make check
with run a test suite designed to catch issues with the installation (however thepytest
package is required).With any luck the package has been installed successfully. A set of test scripts are provided, however a simple check may suffice using an interactive session of the python interpreter:
>>> import phaseshifts >>> from phaseshifts.lib import libphsh # compiled FORTRAN .pyd or .so using f2pyIf these execute without errors then it is likely that all is well, but in case of problems or bugs please use the contact provided below and I will do my best to address the problem quickly.
Tip
On Windows systems it may be easier to install a scientific python distibution
rather than install the dependencies from source - Python(x,y) or
Anaconda with mingw (gcc & gfortran)
installed is highly recommended. Mac OS X users can simply do brew install gfortran
and Debian/Ubuntu users can do sudo apt-get install -y gfortran
.
Note
On unix systems, setup the virtualenv on Python 3.10 or lower, activate it and run make.
Warning
Python 3.12 compatibility is a work in progress due to the removal of numpy.distuils
build backend for f2py
preventing simple installation via pip install
,
this github issue
tracks progress on fixing this known issue.