I would like to start the scientific part of my blog with something I promised myself long time ago that I would write down somewhere, so I would not have to look for answers online ever again. During last 2 years it hasn’t happened though.
Even though I moved completely to Ubuntu for every-day research, I still sometimes use Relion on Windows Subsystem Linux (WSL). Recently we repurchased a new Windows workstation for tomography workflow in Warp (that is only available on Windows). Hence, I was again looking for dependencies that are not listed on the official Relion website. Let’s compile Relion for WSL2!
Make sure that Windows build is recent enough (Windows 10 OS build 20262 or higher) Check this website for details and step by step procedure. Here I just include the most important commands. I would suggest joining the Windows Insider Program and update up to latest Windows 11 build.
Install WSL2. Open Power Shell as admin and paste:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
When done, download the kernel update .
Change the default WSL to WSL2:
wsl --set-default-version 2
Install Ubuntu 20.04LTS from Windows Store. Then, in the Start Menu find Ubuntu icon and start it. You will be prompted to provide new username and password.
Having WSL2 with Ubuntu 20.04LTS installed you can go forward and install Relion.
Update Ubuntu apt library and download required dependencies:
sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install cmake git build-essential mpi-default-bin mpi-default-dev libfftw3-dev libtiff-dev -y # Missing X11 libs sudo apt-get install libx11-dev libxft-dev -y
- Ubuntu on WSL2 is missing X11 libraries, which have to be installed prior the compilation. Having all libraries ready, you can compile Relion. Here is how to compile the CPU accelerated version (the GPU version need way more tweaking).
cd build rm -r * cmake -DALTCPU=ON .. make -j8 #Depending on the number of available CPUs you can use more or less for the compilation step (-j N, where N is the number of CPUs)
- Compilation should finish without errors. Now the binaries can be moved to /usr/local/bin/ directory for global Relion installation, or can be used directly from the folder for local setup:
sudo make install
- If Relion was installed locally, it can be added to $PATH:
- And this is it! Relion should be working now. However, if the Windows build is quite old, the gWSL X-window server might not be present yet in the system. Thus, I’d suggest using VcXsrv Windows X Server . To make it work, start the X-windows server on Windows and export $DISPLAY using bash:
Now everything should be set to start work! Enjoy!