Installation¶
PyXRF is supported for Python 3.9-3.11 in Linux/Mac/Windows systems.
The easiest way to install PyXRF is to load it into a Conda environment from
conda-forge
Anaconda channel. Installation instructions are
identical for all supported OS.
Note
If you experience problems using Conda, in particular if Conda gets stuck trying to resolve the environment, use Mamba, which is designed as a drop-in replacement for Conda. Mamba is included in the Miniforge distribution. It can also be installed in the base environment of an existing installation of Miniconda or Anaconda:
$ conda install -n base --override-channels -c conda-forge mamba 'python_abi=*=*cp*'
See Mamba installation instructions for more details.
How to use `mamba`: Simply replace conda
with mamba
when you create an environment,
install or remove packages, etc. For example
$ mamba create -n pyxrf-env python=3.11 pip -c conda-forge
$ mamba activate pyxrf-env
$ mamba install pyxrf -c conda-forge
Install Miniconda3 or Anaconda. Select the latest version. Miniconda is sufficient for running PyXRF and contains the minimum number of packages. Anaconda is much larger download, which also installs GUI applications for more convenient management of Conda environments.
If Conda is already installed on your computer, proceed to the next step.
Open a terminal (Linux/Mac) or start Anaconda Prompt from Windows Start Menu (Windows).
If you are using existing Conda installation, update Conda:
$ conda update -n base -c defaults conda
If you are installing PyXRF on a Windows platform, close and restart Anaconda Prompt.
Install PyXRF from
conda-forge
Anaconda channels.Create new Conda environment with the desired version of Python (e.g. v3.11):
$ conda create -n pyxrf-env python=3.11 pip -c conda-forge
Activate the new environment:
$ conda activate pyxrf-env
Install PyXRF:
$ conda install pyxrf -c conda-forge
Install PyXRF from
PyPI
:Create new Conda environment with the desired version of Python (e.g. v3.11),
xraylib
andscikit-beam
packages (recommended):$ conda create -n pyxrf-env python=3.11 pip xraylib scikit-beam -c conda-forge
The
scikit-beam
package may be installed may be installed from PyPI if necessary. Third party distribution ofxraylib
package also exists on PyPI.Activate the new environment:
$ conda activate pyxrf-env
Install PyXRF from
PyPI
:$ pip install pyxrf PyQt5
or from source (editable installation):
$ cd <root-directory-of-the-repository> $ pip install PyQt5 $ pip install -e .
Starting PyXRF¶
Open a terminal (Linux/Mac) or start Anaconda Prompt from Windows Start Menu (Windows).
Activate Conda environment that contains PyXRF installation (in our example
pyxrf-env
):$ conda activate pyxrf-env
Start PyXRF by typing:
$ pyxrf
Updating PyXRF¶
Open a terminal (Linux/Mac) or start Anaconda Prompt from Windows Start Menu (Windows)
Activate Conda environment that contains PyXRF installation (in our example
pyxrf-env
):$ conda activate pyxrf-env
Update Conda installation of PyXRF:
$ conda update pyxrf scikit-beam -c conda-forge
Update PyPI installation of PyXRF:
$ conda update scikit-beam -c conda-forge $ pip install --upgrade pyxrf -c conda-forge
if
scikit-beam
was installed using Conda or$ pip install --upgrade scikit-beam pyxrf -c conda-forge
if
scikit-beam
was installed from PyPI.
Deactivating Conda environment¶
$ conda deactivate