wiki:InstallConda

Information here is out-of-date. Please use web site https://gsasii.github.io/ for information on GSAS-II

Installing GSAS-II via conda (Anaconda Python)

Work in Progress: When the gsas2pkg conda package is used, it ensures that the packages required by GSAS-II are installed with versions compatible with the current binary files. This package is being reworked to use git repositories, rather than subversion.

This conda package has been tested on Windows, MacOS (13.6.4, Intel) & (14.3.1, M1) and Linux and seem to work, but the git deployment process is still under development and the git-hosted repository will not always be up-to-date with the master version, still hosted on subversion. Bug reports on problems with this installation/update process are very much desired.

The installation process depends on one significant choice, will GSAS-II be put into a its own conda environment or into the base (main) environment. The latter is a but simpler, but if you will be using conda Python for other purposes other than GSAS-II, you are recommended to give GSAS-II its own environment.

Prerequisite

Before the conda package can be used, you must install conda Python. I suggest using the mambaforge distribution, which is found here: https://github.com/conda-forge/miniforge/releases, but miniforge, miniconda or anaconda Python distributions should all work.

Installation instructions are found here: https://github.com/conda-forge/miniforge/blob/main/README.md or possibly https://docs.anaconda.com/free/miniconda/index.html. If you use the miniconda or anaconda distributions be sure to include -c conda-forge on the conda commands, as some of the required packages will not be found on the standard Anaconda, Inc. package repositories.

For the Raspberry-Pi, wxPython must be installed with pip.

Installing into the base conda environment

There are many possible versions for the commands that will be used to install GSAS-II into the main Python environment, but the command will be the same on MacOS, Linux or Windows:

conda install python=3.11 briantoby::gsas2pkg -c conda-forge

or equivalently

conda install python=3.11 gsas2pkg=4.0 -c briantoby -c conda-forge

Note that the Python=3.11 argument is only needed if the installation has a different version of Python already installed and pinned. Including this does not hurt. Likewise, -c conda-forge is a default with miniforge or mambaforge and can be omitted.

Installing into a new conda environment

Use the command below, or a variant on it. Note that in this command GSASII is the environment name and can be chosen as you wish.

conda create -n GSASII briantoby::gsas2pkg

The different platform-specific shortcuts that are created as part of the GSAS-II installation will provide access to (activate) the conda environment, but if you wish to use that Python installation for some other purpose or to start GSAS-II with a python <path>GSASII.py command, use this:

conda activate GSASII

GSAS-II Shortcuts

After the conda install completes, one of the following should occur:

  • On MacOS, an app is created that can be dragged to the doc (or create a shortcut to GSAS-II.app and drag that anywhere).
  • On Windows a desktop shortcut is created.
  • On Linux (at present) a Desktop item is created and

a command may be placed into the system menu, but how this will work varies greatly with desktop manager. Otherwise, to start GSAS-II from the command-line use:

source <condapath>/bin/activate
python <condapath>/GSASII/GSASII.py

Where <condapath> is the location where mambaforge/miniforge was installed. These commands can be found in file <condapath>/start_GSASII.sh or on windows <condapath>\start_GSASII.bat`

Web Proxies

If your computer network requires a proxy (more info on proxies here). You will need to configure git to use this. I have not researched exactly how this is done.

Activating

If you get an error that conda is an unknown command, this means mambaforge (etc.) is not in your path (which is my recommended way to install anaconda) and you will need to first use the activate command:

  • mac/linux:
    source <condapath>/bin/activate
    
  • windows:
    <condapath>\Scripts\activate
    

With GSAS-II in an environment, the activate command becomes ...activate GSASII

GSAS-II Updates

Note that updates to GSAS-II are not integrated into conda and are not coupled to the specific versions of Python packages you have loaded. To obtain the latest version GSAS-II (you are strongly recommended to update regularly) use the Help/Update menu command (or rerun the gitstrap.py script as described below).

python <condapath>/gitstrap.py

Running gitstrap.py

The supplied gitstrap.py script is used to initially install GSAS-II, but can also be used to obtain updates. This can be useful if GSAS-II will not start and thus updates can not be done from the GUI. To rerun the gitstrap.py script you must use the python installed above. Using this command in a terminal/cmd.exe window:

Windows:

<condapath>\Scripts\activate
python <condapath>\gitstrap.py

Linux/MacOS:

source <condapath>/bin/activate
python <condapath>/gitstrap.py

These commands can be found in file <condapath>/start_G2_bootstrap.sh or on windows <condapath>\start_G2_bootstrap.bat

Sample commands

This is an outline of the commands needed for a test installation on Linux. You probably do not want to use these exact commands as this installs into /tmp which will be be wiped out every time the OS is booted.

curl https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-Linux-x86_64.sh > /tmp/conda3-Linux.sh
bash /tmp/conda3-Linux.sh -b -p /tmp/conda3
source /tmp/conda3/bin/activate
conda update --all
conda install python=3.11 briantoby::gsas2pkg
bash /tmp/conda3/start_GSASII.sh
Last modified 10 months ago Last modified on Aug 15, 2024 11:40:46 AM