wiki:InstallLinux

Version 8 (modified by toby, 9 months 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 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. 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. If so, you can use the conda package manager in Anaconda to install GSAS-II for you with a simple terminal window command:

conda install gsas2pkg=2 -c briantoby 

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.