Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: libGL.so.1 in DynaMight process | Relion ver. 5.0 (β) #1006

Open
komatsuna-san opened this issue Oct 29, 2023 · 3 comments
Open

Comments

@komatsuna-san
Copy link

komatsuna-san commented Oct 29, 2023

I tried the following Relion ver. 5.0 (β) tutorial on SPA for β-galactosidase, from Preprocessing to DynaMight: exploring motions.
https://relion.readthedocs.io/en/release-5.0/SPA_tutorial/index.html

I was able to basically run the tutorial, but in DynaMight: exploring motions, I got the following error:

### run.out ###
---------------------------------- PYTHON ERROR ---------------------------------
   Has RELION been provided a Python interpreter with the correct environment?
   The interpreter can be passed to RELION either during Cmake configuration by
     using the Cmake flag -DPYTHON_EXE_PATH=<path/to/python/interpreter>.
---------------------------------------------------------------------------------

  Using python executable: /usr/local/apps/pyenv/versions/miniforge3-22.9.0-3/envs/relion-conda/bin/python

### run.err ###
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

So, I installed an additional package using apt as follows.

apt install libgl1-mesa-dev

As a result, I was able to avoid the above error and perform the Estimating the motions calculation.

In the Relion installation manual, libgl1-mesa-dev does not seem to be included in the dependencies that should be installed in Debian or Ubuntu.
Perhaps a note needs to be added about this package.

However, I should add that I am testing Relion ver. 5.0 (β) using an Apptainer container based on Ubuntu 22.04 in WSL2 ( AlmaLinux 8 ).
The above error depends on the rather complex environment, others may not encounter this trouble.

@xeniorn
Copy link

xeniorn commented Nov 2, 2023

@komatsuna-san: we'd also like to containerize relion via apptainer - would you be willing to share your def file if you already have it running? Would be highly appreciated.
Cheers,
xen

@komatsuna-san
Copy link
Author

@xeniorn

My current environment is shown below. Note that I have not been able to test all features.

                      OS: AlmaLinux 8 (on WSL2)
               Apptainer: ver. 1.2.3-1.el8
           NVIDIA Driver: ver. 531.41
NVIDIA Container Toolkit: ver. 1.13.5

My apptainer container recipe relion-v5.0b.def is as follows.

BootStrap: docker
From: nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04

%post
  ### Set up Ubuntu ###
  # for localtime WARNING
  touch /etc/localtime

  # Install RELION dependent packages
  apt update && apt upgrade -y
  apt install -y \
    build-essential gcc-9 g++-9 cmake git curl mpi-default-bin mpi-default-dev \
    libtiff-dev libpng-dev ghostscript libxft-dev libgl1-mesa-dev
  
  # Add en_US.UTF-8 to locale
  apt install -y locales
  locale-gen en_US.UTF-8

  # Clean up apt
  rm -rf /var/lib/apt/lists/* && apt autoremove -y && apt clean

  # Default to gcc-9 and g++-9
  update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 99
  gcc --version
  update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 99
  g++ --version
  
  ### Install CTFFIND-4.1.14 ###
  # Prepare the installation directory
  mkdir -p /usr/local/apps/ctffind-4.1.14
  cd /usr/local/apps/ctffind-4.1.14
  
  # Download CTFFIND
  DL_URL='https://grigoriefflab.umassmed.edu/system/tdf?path=ctffind-4.1.14-linux64.tar.gz&file=1&type=node&id=26'
  curl -L ${DL_URL} -o ./ctffind-4.1.14-linux64.tar.gz
  
  # Extract and then remove the downloaded .tar.gz file
  tar -xvf ./ctffind-4.1.14-linux64.tar.gz
  rm -f ./ctffind-4.1.14-linux64.tar.gz
  
  ### Install python libraries for RELION                       ###
  ### Blush, DynaMight, Model-Angelo, Classranker, Topaz, etc.) ###
  # Install Pyenv to /usr/local/apps
  git clone https://github.com/yyuu/pyenv.git /usr/local/apps/pyenv
  export PYENV_ROOT="/usr/local/apps/pyenv"
  export PATH="${PYENV_ROOT}/bin:${PATH}"

  # Install Miniforge through Pyenv
  pyenv install --list
  pyenv install miniforge3-22.9.0-3
  pyenv global miniforge3-22.9.0-3
  pyenv versions
  # Activate the environment of installed Miniforge
  export MINIFORGE3_ROOT="${PYENV_ROOT}/versions/miniforge3-22.9.0-3"
  export PATH="${MINIFORGE3_ROOT}/bin:${PATH}"
  
  # Update conda
  conda update -n base conda
  
  # Clone RELION (ver. 5.0-beta) repository to /usr/local/apps/relion-git
  git clone https://github.com/3dem/relion.git -b ver5.0 /usr/local/apps/relion-git
  cd /usr/local/apps/relion-git
  # Modify the environment.yml to use only conda-forge
  sed -i.bak -e 's|name: relion-5.0|name: relion-conda|g' ./environment.yml
  sed '/- defaults/d' ./environment.yml
  
  # Create a conda environment for RELION (relion-conda)
  conda env create -f ./environment.yml
  # Clean up conda
  conda clean --all --force-pkgs-dirs --yes

  # Activate the relion-conda
  export RELION_CONDA="${MINIFORGE3_ROOT}/envs/relion-conda"
  export PATH="${RELION_CONDA}/bin:${PATH}"
  export LD_LIBRARY_PATH="${RELION_CONDA}/lib:${LD_LIBRARY_PATH}"
  # Check the list of installed libraries
  conda list -n relion-conda

  ### Install RELION (ver. 5.0-beta) ###
  # Prepare directories for RELION build
  mkdir -p /usr/local/apps/relion-git/build
  mkdir -p /usr/local/apps/torch/home
  export TORCH_HOME="/usr/local/apps/torch/home"
  
  cd /usr/local/apps/relion-git/build
  
  # Install RELION to /usr/local/apps/relion-v5.0-beta
  # Add -DAMDFFTW=ON to the following (if AMD CPU)
  cmake \
    -DCMAKE_INSTALL_PREFIX="/usr/local/apps/relion-v5.0-beta" \
    -DFORCE_OWN_FFTW=ON -DFORCE_OWN_FLTK=ON \
    -DPYTHON_EXE_PATH="${RELION_CONDA}/bin/python" \
    -DTORCH_HOME_PATH="${TORCH_HOME}" \
    ..
  make -j8 && make install

%environment
  # For OpenMPI
  export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/openmpi/lib:${LD_LIBRARY_PATH}"
  
  # For RELION
  export RELION_HOME="/usr/local/apps/relion-v5.0-beta"
  export PATH="${RELION_HOME}/bin:${PATH}"
  export LD_LIBRARY_PATH="${RELION_HOME}/lib:${LD_LIBRARY_PATH}"

  # For Blush, DynaMight, Model-Angelo, Classranker, Topaz, etc.
  export MINIFORGE3_ROOT="/usr/local/apps/pyenv/versions/miniforge3-22.9.0-3"
  export RELION_CONDA="${MINIFORGE3_ROOT}/envs/relion-conda"
  export PATH="${RELION_CONDA}/bin:${PATH}"
  export TORCH_HOME="/usr/local/apps/torch/home"
  
  # Default CTFFIND-4.1+ executable
  export RELION_CTFFIND_EXECUTABLE="/usr/local/apps/ctffind-4.1.14/bin/ctffind"

  # The default scratch directory in the GUI
  # (depends on your environment outside this container)
  export RELION_SCRATCH_DIR="/scratch"

%runscript
  "$@"

For example, build the RELION container as follows.

apptainer build ./relion-v5.0b.sif ./relion-v5.0b.def

Start RELION as follows.
Suppose the relion-v5.0b.sif is placed at ${APPTAINER_IMAGE}.

apptainer run --nvccli --bind /scratch:/scratch ${APPTAINER_IMAGE}/relion-v5.0b.sif relion

--nvccli needs nvidia-container-toolkit.

--bind /scratch:/scratch depends on your system.

Regards,

@xeniorn
Copy link

xeniorn commented Nov 4, 2023

Thanks a lot, highly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants