Error in value[[3L]](cond) : Package ‘rhdf5‘ version 2.36.0 cannot be unloaded:

library(rhdf5)
Error in value[[3L]](cond) : Package 'rhdf5' version 2.36.0 cannot be unloaded:Error in unloadNamespace(package) : namespace 'rhdf5' is imported by 'HDF5Array', 'MOFA2' so cannot be unloaded

This is caused by importing packages from two places

Solution:

unloadNamespace('MOFA2')
unloadNamespace('HDF5Array')
library(rhdf5)

success

Read More: