Installing Monocle 3

Required software

Monocle 3 runs in the R statistical computing environment. You will need R version 4.1.0 or higher, Bioconductor version 3.14, and monocle3 1.2.7 or higher to have access to the latest features.

To install Bioconductor, open R and run:

if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.14")

Next, install a few Bioconductor dependencies that aren't automatically installed:

BiocManager::install(c('BiocGenerics', 'DelayedArray', 'DelayedMatrixStats',
                       'limma', 'lme4', 'S4Vectors', 'SingleCellExperiment',
                       'SummarizedExperiment', 'batchelor', 'HDF5Array',
                       'terra', 'ggrastr'))

Now, install monocle3 through the cole-trapnell-lab GitHub, execute:

install.packages("devtools")
devtools::install_github('cole-trapnell-lab/monocle3')

If you wish to install the develop branch of monocle3, execute:

devtools::install_github('cole-trapnell-lab/monocle3', ref="develop")

Testing the installation

To ensure that Monocle 3 was installed correctly, start a new R session and run:

library(monocle3)

Installation troubleshooting

Below are a few of the most common errors that users encounter when installing Monocle 3. If you discover new difficulties, please open an issue on Github describing the problem.

Errors involving Gdal:

Example error messages:
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf’
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
Solution:

One of Monocle 3's dependencies requires a package called gdal. For information on how to install it on your system, see the sf installation instructions here.

Errors involving Xcode:

Solution:

For Mac users only, Xcode command line tools is required. To install, open terminal and type xcode-select --install and then follow the prompts. When it has completed installation, restart the Monocle 3 installation instructions.

Errors involving gfortran:

Example error messages:
make: gfortran: No such file or directory
make: *** [cigraph/src/AMD/Source/amd.o] Error 1
ERROR: compilation failed for package 'leidenbase'
Solution:

The above error indicates that you need to install gfortran on your computer (for Mac users only). In order to do so,

  • Make sure that you have Xcode command line tools installed on your computer.
  • Remove other gfortran installations if they exist. For this, you can launch a terminal window and type "which gfortran". If you see a path returned (e.g. /usr/local/bin/gfortran) you have a previous installation of gfortran that needs to be removed.
  • Download new gfortran binaries for your operating system from here and decompress the folder (eg: gunzip gfortran-8.3-bin.tar.gz).
  • Then run, sudo tar -xvf gfortran-8.3-bin.tar -C / which will install everything in /usr/local/bin/gfortran.

Errors involving reticulate:

Example error messages:
Error in system("which python", intern = TRUE) : 'which' not found
Solution:

Many users report issues configuring 'reticulate' to find their Python installation. These issues seem to be particularly problematic for Windows users. Because of this, we have rewritten the functions that required Python so that Reticulate and Python are no longer required for installation. If you are still getting errors relating to Python or Reticulate, please make sure you are attempting to install Monocle 3 version 0.2.0 or later.

Previous Next