Skip to content

Commit

Permalink
Add notes on installing as user vs developer, and with conda
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed Jun 14, 2019
1 parent 8f50dd2 commit d247ab0
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 55 deletions.
87 changes: 87 additions & 0 deletions INSTALLATION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
============
Installation
============

First, you'll need to have the required C libraries: ``gsl``, ``fftw`` (make sure
you install the floating-point version!)
``openmp`` and ``gslcblas``.

Then follow the instructions below, depending on whether you are a user or a developer.

For Users
---------

.. note:: `conda` users may want to pre-install the following packages before running
the below installation commands::

conda install numpy scipy click pyyaml cffi astropy h5py


Then, at the command line::

pip install git+git://github.com/21cmFAST/21cmFAST.git

If developing, from the top-level directory do::

pip install -e .

Note the compile options discussed below!

For Developers
--------------
If you are developing `21cmFAST`, we highly recommend using `conda` to manage your
environment, and setting up an isolated environment. If this is the case, setting up
a full environment (with all testing and documentation dependencies) should be as easy
as (from top-level dir)::

conda env create -f environment_dev.yml

Otherwise, if you are using `pip`::

pip install -e .
pip install -r requirements_dev.txt

And if you would like to also compile documentation::

pip install -r docs/requirements.txt

Compile Options
---------------
Various options exist to manage compilation via environment variables. Basically,
any variable with "INC" in its name will add to the includes directories, while
any variable with "lib" in its name will add to the directories searched for
libraries. To change the C compiler, use ``CC``. Finally, if you want to compile
the C-library in dev mode (so you can do stuff like valgrid and gdb with it),
install with DEBUG=True. So for example::

CC=/usr/bin/gcc DEBUG=True GSL_LIB=/opt/local/lib FFTW_INC=/usr/local/include pip install -e .

In addition, the ``BOXDIR`` variable specifies the *default* directory that any
data produced by 21cmFAST will be cached. This value can be updated at any time by
changing it in the ``$CFGDIR/config.yml`` file, and can be overwritten on a
per-call basis.

While the ``-e`` option will keep your library up-to-date with any (Python)
changes, this will *not* work when changing the C extension. If the C code
changes, you need to manually run ``rm -rf build/*`` then re-install as above.

Logging in C-Code
~~~~~~~~~~~~~~~~~
By default, the C-code will only print to stderr when it encounters warnings or
critical errors. However, there exist several levels of logging output that can be
switched on, but only at compilation time. To enable these, use the following::

LOG_LEVEL=<log_level> pip install -e .

The ``<log_level>`` can be any non-negative integer, or one of the following
(case-insensitive) identifiers::

NONE, ERROR, WARNING, INFO, DEBUG, SUPER_DEBUG, ULTRA_DEBUG

If an integer is passed, it corresponds to the above levels in order (starting
from zero). Be careful if the level is set to 0 (or NONE), as useful error
and warning messages will not be printed. By default, the log level is 2 (or
WARNING), unless the DEBUG=1 environment variable is set, in which case the
default is 4 (or DEBUG). Using very high levels (eg. ULTRA_DEBUG) can print out
*a lot* of information and make the run time much longer, but may be useful
in some specific cases.
55 changes: 1 addition & 54 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -1,54 +1 @@
============
Installation
============

First, you'll need to have the required C libraries: ``gsl``, ``fftw`` (make sure
you install the floating-point version!)
``openmp`` and ``gslcblas``.

Then, at the command line::

pip install 21cmFAST

If developing, from the top-level directory do::

pip install -e .

Various options exist to manage compilation via environment variables. Basically,
any variable with "INC" in its name will add to the includes directories, while
any variable with "lib" in its name will add to the directories searched for
libraries. To change the C compiler, use ``CC``. Finally, if you want to compile
the C-library in dev mode (so you can do stuff like valgrid and gdb with it),
install with DEBUG=True. So for example::

CC=/usr/bin/gcc DEBUG=True GSL_LIB=/opt/local/lib FFTW_INC=/usr/local/include pip install -e .

In addition, the ``BOXDIR`` variable specifies the *default* directory that any
data produced by 21cmFAST will be cached. This value can be updated at any time by
changing it in the ``$CFGDIR/config.yml`` file, and can be overwritten on a
per-call basis.

While the ``-e`` option will keep your library up-to-date with any (Python)
changes, this will *not* work when changing the C extension. If the C code
changes, you need to manually run ``rm -rf build/*`` then re-install as above.

Logging in C-Code
-----------------
By default, the C-code will only print to stderr when it encounters warnings or
critical errors. However, there exist several levels of logging output that can be
switched on, but only at compilation time. To enable these, use the following::

LOG_LEVEL=<log_level> pip install -e .

The ``<log_level>`` can be any non-negative integer, or one of the following
(case-insensitive) identifiers::

NONE, ERROR, WARNING, INFO, DEBUG, SUPER_DEBUG, ULTRA_DEBUG

If an integer is passed, it corresponds to the above levels in order (starting
from zero). Be careful if the level is set to 0 (or NONE), as useful error
and warning messages will not be printed. By default, the log level is 2 (or
WARNING), unless the DEBUG=1 environment variable is set, in which case the
default is 4 (or DEBUG). Using very high levels (eg. ULTRA_DEBUG) can print out
*a lot* of information and make the run time much longer, but may be useful
in some specific cases.
.. include:: ../INSTALLATION.rst
140 changes: 140 additions & 0 deletions environment_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: 21cmfast
channels:
- defaults
dependencies:
- alabaster=0.7.12=py37_0
- asn1crypto=0.24.0=py37_0
- astropy=3.2=py37h7b6447c_0
- atomicwrites=1.3.0=py37_1
- attrs=19.1.0=py37_1
- babel=2.7.0=py_0
- backcall=0.1.0=py37_0
- blas=1.0=mkl
- ca-certificates=2019.5.15=0
- certifi=2019.3.9=py37_0
- cffi=1.12.3=py37h2e261b9_0
- chardet=3.0.4=py37_1
- click=7.0=py37_0
- cryptography=2.7=py37h1ba5d50_0
- cycler=0.10.0=py37_0
- dbus=1.13.6=h746ee38_0
- decorator=4.4.0=py37_1
- docutils=0.14=py37_0
- expat=2.2.6=he6710b0_0
- fontconfig=2.13.0=h9420a91_0
- freetype=2.9.1=h8a8886c_1
- glib=2.56.2=hd408876_0
- gst-plugins-base=1.14.0=hbbd80ab_1
- gstreamer=1.14.0=hb453b48_1
- icu=58.2=h9c2bf20_1
- idna=2.8=py37_0
- imagesize=1.1.0=py37_0
- importlib_metadata=0.17=py37_1
- intel-openmp=2019.4=243
- ipython=7.5.0=py37h39e3cac_0
- ipython_genutils=0.2.0=py37_0
- jedi=0.13.3=py37_0
- jinja2=2.10.1=py37_0
- jpeg=9b=h024ee3a_2
- kiwisolver=1.1.0=py37he6710b0_0
- libedit=3.1.20181209=hc058e9b_0
- libffi=3.2.1=hd88cf55_4
- libgcc-ng=9.1.0=hdf63c60_0
- libgfortran-ng=7.3.0=hdf63c60_0
- libpng=1.6.37=hbc83047_0
- libstdcxx-ng=9.1.0=hdf63c60_0
- libuuid=1.0.3=h1bed415_2
- libxcb=1.13=h1bed415_1
- libxml2=2.9.9=he19cac6_0
- markupsafe=1.1.1=py37h7b6447c_0
- matplotlib=3.1.0=py37h5429711_0
- mkl=2019.4=243
- mkl_fft=1.0.12=py37ha843d7b_0
- mkl_random=1.0.2=py37hd81dba3_0
- more-itertools=7.0.0=py37_0
- ncurses=6.1=he6710b0_1
- numpy=1.16.4=py37h7e9f1db_0
- numpy-base=1.16.4=py37hde5b4d6_0
- numpydoc=0.9.1=py_0
- openssl=1.1.1c=h7b6447c_1
- packaging=19.0=py37_0
- parso=0.4.0=py_0
- pcre=8.43=he6710b0_0
- pexpect=4.7.0=py37_0
- pickleshare=0.7.5=py37_0
- pip=19.1.1=py37_0
- pluggy=0.12.0=py_0
- prompt_toolkit=2.0.9=py37_0
- psutil=5.6.2=py37h7b6447c_0
- ptyprocess=0.6.0=py37_0
- py=1.8.0=py37_0
- pycparser=2.19=py37_0
- pygments=2.4.2=py_0
- pyopenssl=19.0.0=py37_0
- pyparsing=2.4.0=py_0
- pyqt=5.9.2=py37h05f1152_2
- pysocks=1.7.0=py37_0
- pytest=4.6.2=py37_0
- pytest-arraydiff=0.3=py37h39e3cac_0
- pytest-astropy=0.5.0=py37_0
- pytest-doctestplus=0.3.0=py37_0
- pytest-openfiles=0.3.2=py37_0
- pytest-remotedata=0.3.1=py37_0
- python=3.7.3=h0371630_0
- python-dateutil=2.8.0=py37_0
- pytz=2019.1=py_0
- pyyaml=5.1=py37h7b6447c_0
- qt=5.9.7=h5867ecd_1
- readline=7.0=h7b6447c_5
- requests=2.22.0=py37_0
- scipy=1.2.1=py37h7c811a0_0
- setuptools=41.0.1=py37_0
- sip=4.19.8=py37hf484d3e_0
- six=1.12.0=py37_0
- snowballstemmer=1.2.1=py37_0
- sphinx=2.1.0=py_0
- sphinxcontrib-applehelp=1.0.1=py_0
- sphinxcontrib-devhelp=1.0.1=py_0
- sphinxcontrib-htmlhelp=1.0.2=py_0
- sphinxcontrib-jsmath=1.0.1=py_0
- sphinxcontrib-qthelp=1.0.2=py_0
- sphinxcontrib-serializinghtml=1.1.3=py_0
- sqlite=3.28.0=h7b6447c_0
- tk=8.6.8=hbc83047_0
- toml=0.10.0=py37h28b3542_0
- tornado=6.0.2=py37h7b6447c_0
- tqdm=4.32.1=py_0
- traitlets=4.3.2=py37_0
- urllib3=1.24.2=py37_0
- wcwidth=0.1.7=py37_0
- wheel=0.33.4=py37_0
- xz=5.2.4=h14c3975_4
- yaml=0.1.7=had09818_2
- zipp=0.5.1=py_0
- zlib=1.2.11=h7b6447c_3
- pip:
- aspy-yaml==1.3.0
- bleach==3.1.0
- cfgv==2.0.0
- coverage==4.5.3
- defusedxml==0.6.0
- entrypoints==0.3
- filelock==3.0.12
- identify==1.4.4
- jsonschema==3.0.1
- jupyter-core==4.4.0
- mistune==0.8.4
- nbconvert==5.5.0
- nbformat==4.4.0
- nbsphinx==0.4.2
- nodeenv==1.3.3
- pandocfilters==1.4.2
- pre-commit==1.17.0
- pyrsistent==0.15.2
- pytest-cov==2.7.1
- sphinx-rtd-theme==0.4.3
- testpath==0.4.2
- tox==3.12.1
- virtualenv==16.6.0
- webencodings==0.5.1

1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def find_version(*file_paths):
"cffi>=1.0",
"scipy",
"astropy>=2.0",
"powerbox>=0.5.7",
"h5py>=2.8.0",
"cached_property",
],
Expand Down

0 comments on commit d247ab0

Please sign in to comment.