Version 10 (modified by toby, 2 years ago) (diff)


Installing GSAS-II on Linux systems

There are a number of ways to install GSAS-II on Linux machines. Alas, none work on all Linux dists, because there are so many different versions of libraries files in use and this means that any compiled files created on one Linux version will be incompatible with some others.

GSAS-II is normally distributed with binary (.so) files for the Fortran code used inside GSAS-II. These files are compiled on a Redhat Enterprise Linux system using Python and numPy from the Anaconda Python distribution. You may have compatibility issues with your local version of Linux, depending on what version of Python you have installed and what system libraries are available. See discussions on Compiling Fortran Code and Problems, below. Note that the compiled files we distribute must be matched to both the Python version and the numpy version.

I. Installing the easy way

If you are lucky, you can install GSAS-II by downloading a single file that contains all needed Python packages and then automatically downloads the appropriate files from the GSAS-II svn server using these commands:

curl > /tmp/
bash /tmp/ -b -p ~/g2full

Start GSAS-II with either this command:

~/g2full/bin/python ~/g2full/GSASII/

or this

bash ~/g2full/

see these instructions for more details. This is only available for 64 bit Linux dists running on Intel-compatible processor.

II. Installing for Anaconda Enthusiasts

If you are already a user of Anaconda Python, then you may not want to install yet another version of Python on your computer. Assuming you have anaconda or miniconda installed, you can use the conda package manager to install GSAS-II for you with a simple terminal window command:

conda install gsas2pkg=2 -c briantoby 

Start GSAS-II with either this command:

<condapath>/bin/python <condapath>/GSASII/

or this

bash <condapath>/

This is described here in more detail.

III. Installing Python etc. Manually

GSAS-II will run with any distribution of Python, provided it is version >=3.6, and provided you have the GSAS-II required packages, which include wxPython, NumPy, SciPy, matplotlib and PyOpenGL; some other packages are required for optional functionality; see here for more information on package requirements in GSAS-II. I can report that the ARM version of wxPython runs fine on the Mac, but have not tried this in Linux yet. In general, if you can get Python and the above packages to run on a different CPU type, and can compile (see below), GSAS-II should run.

Provided you can satisfy the above package requirements, then Python dists from Redhat, Debian, Ubuntu,... will work fine. (For some notes on package installation with older versions of Linux, see InstallLinux-prev.) Likewise, alternate Python distributions from Python(x,y), Enthought Canopy and ActiveState ActivePython should work fine, but none have been tested in many years.

You will also need subversion (svn) to download GSAS-II files. All Linux dists offer this (also found in Anaconda).

Once you have installed Python, follow these steps to install GSAS-II:

  1. Create an empty directory. Best to have no spaces in the full path. GSASII is a good name for this, but this is optional. This location will be used as <path> in the instructions below.
  1. Download the installation script ( from Note that <path> below must be an empty directory. Two ways to do this are
    1. with commands:
      mkdir -p <path>
      cd <path>
      svn export .
    2. by loading this URL in a browser: and then move this file to <path>.
  1. Run the script using the python package you have installed with this command in a terminal window

Where <pypath> is the location where python has been installed (may be omitted if this Python is in your path).

The installation script will attempt to create a desktop icon for running GSAS-II, but this may not be appropriate for your Linux configuration. If you want to create a shortcut, have it run <pypath>python <path>

If you are installing GSAS-II on a server and want to download binary files for all supported platforms, use

<pypath>python -server

or equivalently

<pypath>python -allbinaries

Compiling Fortran Code

Most users will not need to do this, but if you get an error message such as:

Failed to run pyspg in .../GSASII/bindist
error: cannot open shared object file: No such file or directory

or an error message about a missing symbol... In this case, you have a choice. You can try to modify your Linux installation to have appropriate libraries (which may be older compatibility versions or updates) or compile the GSAS-II files locally. To do the latter you will need to have the Python scons file and the Linux gfortran compiler installed. If you are using 32-bit Linux (where we are no longer generating binaries) you will have to compile yourself.

If you are using Anaconda Python (see I. and II. above), this can be done with a simple command:

conda install scons gfortran_linux-64

If conda is not in your path, then fix that with this command before running the above:

source <pypath>/bin/activate

Otherwise, you will need to use your Linux package manager to install gfortran and scons. You will also need the NumPy f2py routine, but that should already be present since you already installed NumPy. In a terminal window use the following commands

  1. change the working directory:
    cd <path>/GSASII/fsource and
  1. run scons to start compilation

If you need to change any options, type "scons help" to see a list of the possible command-line arguments and the values for the options. For testing, help can be used with command-line options to see how they will change the variables.


Most GSAS-II testing is done with Windows and Macs (sorry), but we do some testing of GSAS-II on Linux and it does work as far as we are aware. Please do report problems, since we can't fix what we don't know about (see here), but cannot promise to test with your specific Linux dist.

There are many, many versions of Linux and some are too new or old and thus will not have .so libraries installed that allow running our supplied versions of Python or the compiled GSAS-II Fortran code.

You should be able to run GSAS-II with Python and packages from your Linux dist, though sometimes those package versions are so new that you will discover incompatibilities that we have not yet seen. To avoid that you can use the Anaconda Python installer, which is included in the file referenced in Step I above.

One problem we have seen with this comes from not running the installer properly. Please make sure you are typing bash correctly and leaving a space between that and the file name, also be sure you are allowed to write files to the location you choose for installation. If starts but does not complete, delete the previous installation directory before trying again.

If you see an error message like this when starting GSAS-II:

Failed to run pyspg in /home/me/anaconda3/envs/G2/GSASII/bindist
error: cannot open shared object file: No such file or directory

then you may be able to address the problem by installing a compatibility library (using a command like this: yum install libgfortran4). A Google search with the name of the missing library and the name of your distribution (CentOS, Ubuntu, Fedora,...) may help.


With and the conda gsas2pkg installers from January 2021 and later, the installer creates file <condapath>/ which can be run in bash to launch the bootstrap process. Otherwise a command like this is needed:

~/g2full/bin/python ~/g2full/GSASII/

changing the prefix ~/g2full/ to reflect your choice for <condapath>.

Running the file should update GSAS-II to the latest version and complete any remaining installation steps and will. Note that this script requests the name of a proxy server. For most people, none is needed and they should simply use the the default by pressing return. However, some sites block web traffic unless it is passed through a particular computer. If needed, enter that computer name or IP address here (e.g.; you will be then be requested to also supply a port number, which defaults to 8080. If you are able to download files but updates fail, see the discussion of web proxies.