wiki:InstallLinux

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 files for Python and associated packages from the Anaconda Python distribution. If these files are not compatible with your version of Linux, you will need to obtain Python & required packages through some method, such packages distributed by your Python distribution channel. We also distribute compiled library (.so) files for the Fortran code used inside GSAS-II. These files need to be matched to the Python version and the numpy version, but sometimes despite this they will need to be compiled in the Linux environment where they will be used.

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 https://subversion.xray.aps.anl.gov/admin_pyGSAS/downloads/gsas2full-Latest-Linux-x86_64.sh > /tmp/gsas2full-Latest-Linux-x86_64.sh
bash /tmp/gsas2full-Latest-Linux-x86_64.sh -b -p ~/g2full

Start GSAS-II with either this command:

~/g2full/bin/python ~/g2full/GSASII/GSASII.py

or this

bash ~/g2full/start_GSASII.sh

see these instructions for more details. This is only available for 64 bit Linux dists.

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/GSASII.py

or this

bash <condapath>/start_GSASII.sh

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. As far as I am aware, wxPython is only supported on Intel-compatible CPUs, but if you can get Python and the above packages to run on a different CPU and can compile (see below) GSAS-II should run.

Provided you can satisfy the above 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 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 (bootstrap.py) from https://subversion.xray.aps.anl.gov/pyGSAS/install/. 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 https://subversion.xray.aps.anl.gov/pyGSAS/install/bootstrap.py .
      
    2. by loading this URL in a browser: https://subversion.xray.aps.anl.gov/trac/pyGSAS/browser/install/bootstrap.py?format=txt and then move this file to <path>.
  1. Run the bootstrap.py script using the python package you have installed with this command in a terminal window
<pypath>python bootstrap.py

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>GSASII.py

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

<pypath>python bootstrap.py -server

or equivalently

<pypath>python bootstrap.py -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: libgfortran.so.3: 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
    scons
    

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.

Problems

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 a specific Linux dist.

There are many, many versions of Linux and some are too new or old and will not have compatible .so libraries with either the GSAS-II code and/or Python. Sometimes installing compatibily libraries are needed. How to do this is best determined with a Google search relevant you your Linux dist. If you are able to download the gsas2full-Latest-Linux-x86_64.sh file, but the install does not run properly, you may not be executing the bash command 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.

Rerunning bootstrap.py

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

~/g2full/bin/python ~/g2full/GSASII/bootstrap.py

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

If GSAS-II is installed, this will complete any remaining installation steps and will update GSAS-II to the latest version. 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. proxyout.lanl.gov); 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.

Last modified 5 months ago Last modified on Jan 6, 2021 5:17:28 PM