Skip to content

Commit

Permalink
Merge pull request #323 from neutrons/add-conda-environment-file
Browse files Browse the repository at this point in the history
Add conda environment file + update README
  • Loading branch information
marshallmcdonnell authored Jan 15, 2021
2 parents 5d82b37 + fe91878 commit a72b548
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 83 deletions.
91 changes: 32 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
| CI | Release |
|--------|---------|
| [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fneutrons%2Faddie%2Fbadge&style=plastic)](https://actions-badge.atrox.dev/neutrons/addie/goto) | [![Anaconda-Server Badge](https://anaconda.org/addie-diffraction/addie/badges/version.svg)](https://anaconda.org/addie-diffraction/addie) |
| | [![Anaconda-Server Badge](https://anaconda.org/addie-diffraction/addie/badges/platforms.svg)](https://anaconda.org/addie-diffraction/addie) |
| CI | Release | Other |
|--------|---------|-------|
| [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fneutrons%2Faddie%2Fbadge&style=plastic)](https://actions-badge.atrox.dev/neutrons/addie/goto) | [![Anaconda-Server Badge](https://anaconda.org/addie-diffraction/addie/badges/version.svg)](https://anaconda.org/addie-diffraction/addie) | [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT) |
| | [![Anaconda-Server Badge](https://anaconda.org/addie-diffraction/addie/badges/platforms.svg)](https://anaconda.org/addie-diffraction/addie) | |

ADDIE
======
# ADDIE

**ADDIE** stands for **AD**vandced **DI**ffraction **E**nvironment, a data reduction application for total scattering powder diffraction data.

Expand All @@ -14,49 +13,22 @@ This "reduction" entails taking raw neutron counts from detectors in the diffrac

ADDIE is a front-end GUI for total scattering that hopes to support multiple diffractometers performing total scattering measurements. The back-end that uses the [Mantid Framework](https://docs.mantidproject.org/nightly/) is the [`mantid-total-scattering`](https://github.com/marshallmcdonnell/mantid_total_scattering) project.

Installation
------------

### Anaconda

**Setup**

Add channels with dependencies, create a conda environment with `python_version` set to either `2.7.14` or `3.6`, and activate the environment
## Install

```
conda config --add channels conda-forge --add channels marshallmcdonnell --add channels mantid --add channels mantid/label/nightly
conda create -n addie_env python=${python_version}
source activate addie_env
```

**Install (or Update)**

```
conda install -c addie-diffraction addie
```

If there are issues with `mantid-workbench` or `mantid-total-scattering` dependencies (broken, errors, etc.), then you can delete the environment and re-install `addie` in a new environment ("turn it off and back on again")

Go here for how to delete an [environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#removing-an-environment) or use:

```
conda remove --name addie_env --all
```

**Notes**

If you have an error (see below for example) related to the `libGL` library, you may not have it installed for the Mantid Framework to work. See instructions [here](https://github.com/mantidproject/conda-recipes/#gl-and-glu-libs) for installing the necessary libraries for different OS

Example error:
`ImportError: First import of "._api" failed with "libGL.so.1: cannot open shared object file...`

If you have an error that another version of Mantid is installed on the machine and being imported via `PYTHONPATH`, you can use the following as a workaround for CLI tool:
## Uninstall

```
PYTHONPATH="" addie
conda deactivate
conda remove -n addie_env --all
```

# Usage (CLI reduction tool)
## Launch

To launch ADDIE, run the following from the command line:

Expand All @@ -70,40 +42,43 @@ MANTIDPATH=/path/to/mantid/build/bin PATH=$MANTIDPATH:$PATH PYTHONPATH=$MANTIDPA
```


Development
------------
## Development

### Building

Before doing the normal `python setup.py ...` things you must convert the
`designer/*.ui` files to `addie*.py`. This is done with
`python setup.py pyuic`. After that, all the normal
[setuptools](https://pythonhosted.org/setuptools/setuptools.html) magic applies.
### Installation development environment using Conda
```
conda env create
source activate addie
python setup.py install
```
### Uninstall

To run from source (step 1 only needs to be done if the `.ui` file changes):
```bash
$ addiedevel.sh
```
If you are want to specify a different `mantidpython`, then add it as
a command line argument
```bash
$ addiedevel.sh /opt/mantid37/bin/mantidpython
conda deactivate
conda remove -n addie --all
```

Similarly, there is a script for windows (experimental)
**Notes**

If you have an error (see below for example) related to the `libGL` library, you may not have it installed for the Mantid Framework to work. See instructions [here](https://github.com/mantidproject/conda-recipes/#gl-and-glu-libs) for installing the necessary libraries for different OS

Example error:

```
addiedevel.bat
ImportError: First import of "._api" failed with "libGL.so.1: cannot open shared object file...
```


### Testing

The test suite can be run using [pytest](https://docs.pytest.org/en/latest/)
with the [pytest-qt](https://pytest-qt.readthedocs.io/en/latest/) plugin.
```bash
$ pytest tests
```


Developing using virtual environments
-------------------------------------
### Developing using a local Mantid install

If you normally develop using `virtualenv` or friends, you can develop
addie that way as well. After creating the virtual environment, run
Expand Down Expand Up @@ -138,8 +113,7 @@ echo layout_pipenv > .envrc
direnv allow
```

Creating RPMs
-------------
## Creating RPMs

Python generated `srpm` are not as flexible as they should be. To
generate one that is run `buildrpm` and look for the files in the
Expand All @@ -151,4 +125,3 @@ $ ./buildrpm
[copr](https://copr.fedorainfracloud.org/coprs/peterfpeterson/addie/).


[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)
36 changes: 12 additions & 24 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
name: addie
channels:
- conda-forge
- marshallmcdonnell
- mantid
dependencies:
- cycler=0.10.0=py27_0
- freetype=2.5.5=0
- libpng=1.6.17=0
- matplotlib=1.5.1=np111py27_0
- mkl=11.3.1=0
- numpy=1.11.0=py27_0
- openssl=1.0.2g=0
- periodictable==1.5.0
- pip=8.1.1=py27_1
- pyparsing=2.1.1=py27_0
- pyqt=4.11.4=py27_1
- python=2.7.11=0
- python-dateutil=2.5.2=py27_0
- pytz=2016.3=py27_0
- qt=4.8.7=1
- readline=6.2=2
- setuptools=20.7.0=py27_0
- sip=4.16.9=py27_0
- six=1.10.0=py27_0
- sqlite=3.9.2=0
- tk=8.5.18=0
- wheel=0.29.0=py27_0
- zlib=1.2.8=0

- python=3.6
- configparser
- mantid-total-scattering-python-wrapper
- mantid-workbench
- periodictable
- psutil
- setuptools
- simplejson

0 comments on commit a72b548

Please sign in to comment.