wiki:InstallConda

Version 10 (modified by toby, 9 months ago) (diff)

--

Installing GSAS-II via conda (Anaconda Python)

Python enthusiasts are likely quite familiar with the Anaconda package manager. GSAS-II can be installed using a simple conda command, after installing anaconda or miniconda. We are currently recommending Python 3.8. With Python 3.9 or later, you will likely need to compile binaries. When this conda package is used, it ensures that the packages required by GSAS-II are installed, including subversion, and then subversion is used to download the latest version of GSAS-II from the APS server. This download will fail if your computer network requires a proxy (more info on proxies here), but rerunning the bootstrap.py command (see bottom of this page) will work after the proxy information is entered.

conda install gsas2pkg=2 -c briantoby

If the environment fails to solve, this is likely because Anaconda has not built a compatible wxpython package. As I write this, this is true for python 3.8. Change -c briantoby to -c defaults -c briantoby -c conda-forge in the command above using:

conda install gsas2pkg=2 -c defaults -c briantoby -c conda-forge

After the conda install completes, one of the following occurs:

  • On the Mac, 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) the command-line is needed to start GSAS-II:
    source <condapath>/bin/activate
    python <condapath>/GSASII/GSASII.py
    
    Where <condapath> is the location where anaconda/miniconda was installed. These commands can be found in file <condapath>/start_GSASII.sh

Conda bug on Linux

At present, it appears that conda is failing to run properly on Linux and requiring a Mac package. Use package gsas2pkg-linux with this command:

conda install gsas2pkg-linux=2 -c briantoby

Using a Conda Environment

It can be a good idea to place GSAS-II in a separate environment so that package versions do not conflict. This is recommended if you have any other packages with particular version dependencies. To use a separate conda environment for GSAS-II, use these commands to install GSAS-II:

conda create gsas2pkg=2 -c briantoby -n G2

Note that the GSAS-II files will be placed in <conda>/env/G2/GSAS-II.

To run GSAS-II, you will need to activate the environment manually before starting GSAS-II (conda activate G2). On Windows manually edit the runGSASII.bat file to add this. On Mac OS X the created application seems to work OK (or use commands in <condapath>/start_GSASII.sh). On Linux use these use these commands:

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

Where <condapath> is the location where anaconda/miniconda was installed. These commands can be found in file <condapath>/start_GSASII.sh

Activating

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

mac/linux:

source <condapath>/bin/activate

windows:

<condapath>\Scripts\activate

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

Python 2.7: We strongly discouraging use of Python 2.7 and are no longer testing GSAS-II compatiblity with Python 2.7 (but will usually fix problems, if reported).

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 bootstrap.py script using this command:

<condapath>/bin/python <condapath>/GSASII/bootstrap.py

Notes on anaconda installation

Here are commands that worked for me recently on Linux.

curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > /tmp/Miniconda3-latest-Linux-x86_64.sh
bash /tmp/Miniconda3-latest-Linux-x86_64.sh -b -p /tmp/conda3
source /tmp/conda3/bin/activate
conda update --all
conda install gsas2pkg-linux=2 -c briantoby
bash /tmp/conda3/start_GSASII.sh

To create GSAS-II in an environment I used this:

conda create -n G2 gsas2pkg-linux -c briantoby