Skip to content

Commit f120afc

Browse files
committed
Update README with conda instructions.
1 parent 173129f commit f120afc

1 file changed

Lines changed: 47 additions & 28 deletions

File tree

README.rst

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ http://diffpy.github.io/diffpy.srreal.
4646
REQUIREMENTS
4747
------------------------------------------------------------------------
4848

49-
The diffpy.srreal requires Python 2.6 or 2.7 and the following software:
49+
The diffpy.srreal requires Python 2.7, C++ compiler and
50+
the following software:
5051

5152
* ``setuptools`` - tools for installing Python packages
5253
* ``NumPy`` - library for scientific computing with Python
@@ -58,62 +59,61 @@ The diffpy.srreal requires Python 2.6 or 2.7 and the following software:
5859
* ``diffpy.Structure`` - simple storage and manipulation of atomic structures
5960
https://github.com/diffpy/diffpy.Structure
6061

61-
Recommended software:
62+
Optional software:
6263

6364
* ``periodictable`` - periodic table of elements in Python
6465
http://www.reflectometry.org/danse/elements.html
6566
* ``pyobjcryst`` - Python bindings to ObjCryst++, the Object Oriented
6667
Crystallographic library for C++, https://github.com/diffpy/pyobjcryst.
6768

68-
Some of the required software may be available in the system package manager,
69-
for example, on Ubuntu Linux the dependencies can be installed as::
69+
We recommend to use `Anaconda Python <https://www.continuum.io/downloads>`_
70+
as it allows to install all software dependencies together with
71+
diffpy.srreal. For other Python distributions it is necessary to
72+
install the required software separately. As an example, on Ubuntu
73+
Linux some of the required software can be installed using ::
7074

7175
sudo apt-get install \
7276
python-setuptools python-numpy scons \
7377
build-essential python-dev libboost-all-dev
7478

75-
For Mac OS X machine with the MacPorts package manager one could do ::
79+
To install the remaining packages see the installation instructions
80+
at their respective web pages.
7681

77-
sudo port install \
78-
python27 py27-setuptools py27-numpy scons boost
7982

80-
When installing with MacPorts, make sure the MacPorts bin directory is the
81-
first in the system PATH and that python27 is selected as the default
82-
Python version in MacPorts::
83-
84-
sudo port select --set python python27
83+
INSTALLATION
84+
------------------------------------------------------------------------
8585

86-
For other required packages see their respective web pages for installation
87-
instructions.
86+
The preferred method is to use Anaconda Python and install from the
87+
"diffpy" channel of Anaconda packages ::
8888

89+
conda config --add channels diffpy
90+
conda install diffpy.srreal
8991

90-
INSTALLATION
91-
------------------------------------------------------------------------
92+
diffpy.srreal is also included in the "diffpy-cmi" collection
93+
of packages for structure analysis ::
9294

93-
The easiest option is to use the latest DiffPy-CMI release bundle from
94-
http://www.diffpy.org, which comes with diffpy.srreal and all other
95-
dependencies included.
95+
conda install diffpy-cmi
9696

9797
If you prefer to install from sources, make sure all required software
9898
packages are in place and then run ::
9999

100-
sudo python setup.py install
100+
python setup.py install
101101

102-
This installs diffpy.srreal for all users in the default system location.
103-
If administrator (root) access is not available, see the usage info from
104-
``python setup.py install --help`` for options to install to a user-writable
105-
location. The installation integrity can be verified by changing to
106-
the HOME directory and running ::
102+
You may need to use ``sudo`` with system Python so the process is
103+
allowed to copy files to the system directories. If administrator (root)
104+
access is not available, see the output from
105+
``python setup.py install --help`` for options to install to
106+
a user-writable location. The installation integrity can be verified by
107+
changing to the HOME directory and running ::
107108

108109
python -m diffpy.srreal.tests.run
109110

110111
An alternative way of installing diffpy.srreal is to use the SCons tool,
111-
which can speed up the process by compiling the C++ files in parallel (-j4)::
112+
which can speed up the process by compiling the C++ files in parallel (-j4) ::
112113

113114
sudo scons -j4 install
114115

115-
See ``scons -h`` for build parameters and options to install to a user-writable
116-
directory.
116+
See ``scons -h`` for decription of build targets and options.
117117

118118

119119
DEVELOPMENT
@@ -135,6 +135,25 @@ integrity, use ::
135135

136136
scons -j4 build=debug develop [test]
137137

138+
When developing with Anaconda Python it is essential to specify
139+
header path, library path and runtime library path for the active
140+
Anaconda environment. This can be achieved by setting the ``CPATH``,
141+
``LIBRARY_PATH`` and ``LDFLAGS`` environment variables as follows::
142+
143+
# resolve the prefix directory P of the active Anaconda environment
144+
P="$(conda info --json | grep default_prefix | cut -d\" -f4)"
145+
export CPATH=$P/include
146+
export LIBRARY_PATH=$P/lib
147+
export LDFLAGS=-Wl,-rpath,$P/lib
148+
# compile and re-install diffpy.srreal
149+
scons -j4 build=debug develop
150+
151+
On Mac OS X the distributed Anaconda packages are built for operating
152+
system version 10.6, which may be incompatible with codes compiled on a
153+
newer OS. To avoid this problem set the environment variable
154+
``MACOSX_DEPLOYMENT_TARGET=10.6``. This allows to build diffpy.srreal
155+
against the Anaconda package for the libdiffpy library.
156+
138157

139158
CONTACTS
140159
------------------------------------------------------------------------

0 commit comments

Comments
 (0)