File: install.rst

package info (click to toggle)
genx 3.8.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 39,152 kB
  • sloc: python: 79,013; makefile: 153; sh: 92; xml: 7
file content (192 lines) | stat: -rw-r--r-- 6,885 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
.. _install:

************
Installation
************

Windows
=======

Download the windows installer GenX-3.X.X_win64_setup.exe from the
`home page <https://github.com/aglavic/genx/releases/latest>`_ and follow the instructions in the installation
guide.

Mac OS
======

Binary packages for Mac OS are `provided <https://github.com/aglavic/genx/releases/latest>`_ as
GenX3-3.X.X-M1-Installer.pkg and GenX3-3.X.X-Installer.pkg packages that can directly be installed. If you are having
trouble with this distribution you can try installing from source. (And create a trouble ticket, please.)

Since a while the use of packages for wxPython from PyPI is possible, too. So system python3 with pip should be
sufficent to install all requirements. (See instructions below.)

If this fails, too, install the required python 3 packages, especially wxPython manually.
I would advice using a new Anaconda environment. Afterwards you can install GenX from source.
The anaconda environment packages that are known to work can be found in
`conda_build.yml <https://raw.githubusercontent.com/aglavic/genx/v3.6.14/genx/mac_build/conda_build.yml>`_


Linux
=====

Install the requirements, at least wxPython, from your package manager (Ubuntu ``python3-wxgtk4.0``).
Then either install from source or, if you are using Ubuntu or a derivative, you can use the pre build .deb packages
for your system python version.

.. note::
    For compatibility with Ubuntu 24.04 the python3-numba package will no longer be installed automatically.
    I highly recommend installing it manually as it has significant impact on simulation performance.

As an example, installation in Ubuntu 24.04 could look like this:

.. code-block:: bash

    sudo apt update
    wget https://github.com/aglavic/genx/releases/download/v3.6.26/GenX-3.6.26_py312.deb
    sudo dpkg -i GenX-3.6.26_py312.deb
    sudo apt -f install
    sudo apt install python3-pip
    python3 -m pip install --break-system-packages numba pint orsopy svgwrite pymysql bumps

Snap
----

The most convenient way to install GenX on Linux is the `snap package <https://snapcraft.io/genx>`_.
It ships all requirements and should work on any distribution where the snap package management tool is installed.
(e.g. all Ubuntu derivatives have it pre-installed)
See https://snapcraft.io/docs/installing-snapd for instructions how to install snapd on your distribution.

To install via snap use:

.. code-block:: bash

    sudo snap install genx

The encapsulation of snap packages means, that they are more compatible over various Linux distros but sometimes
limit functionality. For the most part this could be circumvented in my tests. There is currently one know limitation
when using GenX installed through snap via X11-forwarding over SSH. In this case, it is possible to work around the
display accesss error by creating a manual link via:

.. code-block:: bash

    ln -s ~/.Xauthority ~/snap/genx/current/.Xauthority

.. _install_cluster:

Clusters
--------

GenX can make use of MPI to run models on cluster systems. In many cases the user does not have the rights
to install libraries and there are various configurations that can be configured and make installation
of own libraries pretty complicated.
On the other hand, fitting with GenX from command line does not require the wx or matplotlib libraries to be present.

In case the cluster does not provide a python installation that is new enough (>=3.6), you can try to
make use of the Miniconda distribution, all required software can be installed as a user without too much
background knowladge of Linux configurations.

Using system python
...................

* Create python virtual environment
    .. code-block:: bash

        python -m venv /path/to/new/virtual/environment
        source /path/to/new/virtual/environment/bin/activate # script depends on your used shell

* Install via pip with you local python, which should install all requirements automatically
    .. code-block:: bash

        python -m pip install genx3server


Using Minconda
..............

* Install Miniconda: https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html
* Prepare anaconda environment and required packages
    .. code-block:: bash

        conda create -n genx python=3.9
        conda activate genx
        conda install pip platformdirs h5py scipy psutil numba
        pip install orsopy bumps

    * Depending on configuration you might need to install other libraries like glib if the installed
      libraries are too old.

    * I don't recommend to use the mpi version of anaconda but instead follow the instructions on how to install
      mpi4py for the local mpi library using pip:

      https://mpi4py.readthedocs.io/en/stable/install.html
* Finally install the server package for GenX:
    .. code-block:: bash

        pip install genx3server

* Tip: You can configure conda environments to update environment variables when they are activated.
  This can become handy if you need to selec specific library versions, PATH or LD_LIBRARY_PATH.
  ``conda env config vars set NAME=value``.





From source
===========

`Download <https://github.com/aglavic/genx/releases/latest>`_ the source distribution GenX-3.X.X.tar.gz
and unpack it. Run the file scripts/genx directly:

.. code-block:: bash

    tar -xvzf GenX-3.X.X.tar.gz
    cd GenX-3.X.X
    python3 scripts/genx

You can also install it in your python 3 environment as user ``pip3 install --user genx3`` or
system wide ``sudo pip3 install genx3`` as well as the optional requiremetns and run:

.. code-block:: bash

    pip3 install --user genx3 numba vtk bumps pymysql
    genx

Or in a virtual environment / if python default is 3.x:

.. code-block:: bash

    python -m pip install genx3 numba vtk bumps pymysql
    genx


Requirements
------------

The needed dependencies are:

* Python >= 3.6 (recommend >= 3.8)
* wxPython version > 4.0  (recommend >= 4.1)
* Numpy version > 1.0
* Scipy version > 0.5
* Matplotlib version > 0.9
* platformdirs
* h5py
* orsopy >= 1.2.0

The non-mandotary packages are

* mpi4py (with an MPI installation)
* numba (calculation speedup by Just In Time compiler)
* vtk (graphical display of unit cells)
* svgwrite (for graphical image showing the layring - LayerGraphics plugin)
* pint (support in orsopy conversion of units)
* pymysql (access of crystallography open database for SLD - SimpleLayer plugin
* bumps (statistical analysis and alternative refinement method)
* docutils (improves how help pages are displayed)

With modern python environments, all requirements can be installed via pip and, despite for the optional packages,
are being automatically installed when using the genx3 package.
On a Linux system these packages can usually be installed through the package manager. On a windows and OSX systems the
anaconda distribution contains all packages.