wiki:InstallPiLinux

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

--

Installing GSAS-II on Raspberry Pi (Linux) systems

GSAS-II can be run on 32-bit and 64-bit Raspberry Pi systems running the two most recent versions of the Raspberry Pi OS (formerly called Raspbian) and pretty much any of the models, though the Pi Zero with only 0.5 Gb of memory is probably a bit small and slow for larger refinements; OTOH it does cost only $5. (The Pi Zero 2W is a much better choice, however).

The ideal OS version to install is the 64-bit version of the current Raspberry Pi OS, tagged as Bullseye, (based on Debian 10), but this runs only on the following Pi models: 3B, 3B+, 3A+, 4, 400, CM3, CM3+, CM4, Zero 2W OS download from here. On all other machines, one should use 32-bit Bullseye, although the previous version (Buster, based on Debian 9) can also be used.


1. Installing GSAS-II on 64-bit Raspberry Pi OS

This provides instructions for using a provided installation kit built specifically for OS 64-bit Raspberry Pi OS Bullseye. The advantage of this is that the https://subversion.xray.aps.anl.gov/admin_pyGSAS/downloads/gsas2full-Latest-Linux-aarch64.sh can be downloaded once and broadcast to many computers, saving internet bandwidth or even for computers that are not on the net, but the second installation method should work (perhaps with minor modifications) on all Pi OS versions and might be simpler.

1A. Install prerequisites

After the computer is first booted, a few commands are worthwhile to update the OS. These are all optional, but are recommended:

sudo apt update
sudo apt full-upgrade
sudo apt autoremove

GSAS-II needs the subversion and lxterminal packages and we will use the wget command. Use this command to install them:

sudo apt install subversion lxterminal wget

1B. Install Python & GSAS-II

Then use the following commands to download and install Python and GSAS-II with a conda-forge based installer. These commands do not require sudo access. To allow GSAS-II to be updated from the program and to save config options, they should be run from the same account where GSAS-II will be run, which ideally should be a "user" rather than an "admin" account, such as what was used in the previous step.

wget https://subversion.xray.aps.anl.gov/admin_pyGSAS/downloads/gsas2full-Latest-Linux-aarch64.sh -O /tmp/gsas2full-Latest.sh
bash /tmp/gsas2full-Latest.sh -b -p ~/g2full

1C. Starting GSAS-II

The above will create a desktop shortcut and a command in the desktop manager's "Other" menu (click on the Raspberry icon in the upper left corner), but it is also possible to start GSAS-II with either this command:

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

or this:

bash ~/g2full/start_GSASII.sh

Note that ~/g2full above specifies where GSAS-II and its Python installation will be placed. This can be changed in all of the above at your convenience. You can have multiple GSAS-II installations in separate directories if desired. These instructions provide for more details on the self-installer.


2. Installing GSAS-II on 32-bit Raspberry Pi OS

2A. Update the OS, Prerequisites

All work was done after updating to the latest software versions (this update may not be required, but is likely a good idea) with these commands:

sudo apt update
sudo apt full-upgrade
sudo apt autoremove

These commands must be run from an account that has sudo access (such as the initial pi user account.) The full-upgrade command may take a while to complete (10-60+ minutes), depending on internet download speeds and the Pi model.

The subversion package is required to install and update GSAS-II and a number of Python packages are also required. Enter these commands to install them:

sudo apt install subversion lxterminal wget
sudo apt install python3-wxgtk4.0 python3-numpy python3-scipy 
sudo apt install python3-matplotlib python3-opengl 
sudo apt install python3-pil python3-h5py python3-imageio

(these lines can be combined into a single command if desired).

2B: Install GSAS-II

The following commands download GSAS-II, obtain the correct binary files that have been compiled for the Pi with 32 bits. These commands do not require sudo access. To allow GSAS-II to be updated from the program and to save config options, they should be run from the same account where GSAS-II will be run, which ideally should be a "user" rather than an "admin" account, in contrast to the previous steps, which require sudo access.

This will create two shortcuts for starting GSAS-II: a desktop icon and an entry in the "Other" category of the system menu.

mkdir ~/GSASII
cd ~/GSASII
svn export https://subversion.xray.aps.anl.gov/pyGSAS/install/bootstrap.py .
python bootstrap.py

Note that the software can be installed anywhere that is desired, so the location "~/GSASII" in the first two commands can be replaced with anything you want, such as ~/software/G2, but the directory should be empty and thus created in this step. Note that more than one version of GSAS-II can be installed by placing them in different directories, but note that the desktop/menu shortcuts must be duplicated with new file names as a second installation will replace the first copies of those files.

After the python command is entered, the installation script will ask for a proxy address. At most locations, this is not needed (network proxy info here), so simply press enter to start the installation. The GSAS-II files are then downloaded and then the binary files are downloaded. This goes pretty quick (<1 minute with fast internet) as the download is fairly small.

If the installation is successful, a new GSAS-II icon will appear on the desktop. If not an error message should be displayed. If this occurs, you may want to get in touch with Brian.

2C. Starting GSAS-II

The above will create a desktop shortcut and a command in the desktop manager's "Other" menu (click on the Raspberry icon in the upper left corner), but it is also possible to start GSAS-II with this command:

python ~/GSASII/GSASII.py

However, if GSAS-II will be started in some manner other than a command from a terminal window of some flavor, use this command to open a terminal window and start GSAS-II inside it:

lxterminal -t "GSAS-II console" -e bash -c "python /home/pi/GSASII/GSASII.py; echo Press Enter to close window; read line"

Optional: Fix annoying desktop shortcut message

When one double-clicks on the GSAS-II desktop icon, a message saying “This text file ‘GSAS-II’ seems to be an executable script. What do you want to do with it?” One can then click on Execute and the program starts in a new Window:

shortcut warning

To avoid this step, it is possible to turn off this message for all desktop icons in the file manager preferences. To do this, find the File Manager launcher in the system menu in the Accessories section or click on the file folder icon at the upper left:

flie browser shortcut

In the File Manager, use the File and then the Preferences menu commands:

file browser options

This opens the preferences page, where "don't ask options on launch executable" should be checked:

set option

(This based on info here).

Timing Notes

Results from tests with a pretty massive (MacGovernite) test refinement. Raspberry Pi OS is 32 bit, except as noted.

System OS timing
Pi Zero 0 W Buster 1353 sec
Pi 3 B+ Bullseye 1408 sec
Pi 400 Buster (32-bit) 476 sec
Pi 400 Bullseye, 32-bit 644 sec
Pi 400 Bullseye, 64-bit 496 sec
comparisons
Intel Mac Pro (2020) MacOS 10.15.7 118 sec
M1 Mac Pro (2021) MacOS 11.6.2 58 sec

timing commands:

pi@raspberrypi:~ $ cp G2timing.gpx /tmp/
pi@raspberrypi:~ $ cd /tmp
pi@raspberrypi:/tmp $ python3 ~/GSASII/GSASII.py G2timing.gpx 

Attachments (4)

Download all attachments as: .zip