Skip to content

How to fix namespace error for mac users

Vijender Singh edited this page Jun 1, 2020 · 3 revisions

How to fix the namespace error for Mac users.

Issue:

> library(DESeq2)
Error: package or namespace load failed for ‘DESeq2’ in loadNamespace

How to Fix:

  1. Installed R (R-3.6.3.nn.pkg) since I do not have the new OS Catalina

  2. Then installed BiocManager version 3.10

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(version = "3.10")
  1. Then installed DESeq2
if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("DESeq2")

which gave me non-zero erro on nlme and hmisc packages.

  1. Then Downloaded the binary of nlme_3.1-145.tgz for MacOS from CRAN (https://cran.r-project.org/web/packages/nlme/index.html), and installed it using:
install.packages('/Users/Downloads/nlme_3.1-145.tgz', repos = NULL, type = "source" )
  1. Then downloaded binary Hmisc_4.3-1.tgz from CRAN (https://cran.r-project.org/web/packages/Hmisc/index.html) then installed it using:
install.packages('/Users/Downloads/Hmisc_4.3-1.tgz', repos = NULL, type = "source" )
  1. Then reinstall
BiocManager::install("DESeq2")

which promted

Old packages: 'Hmisc'
Update all/some/none? [a/s/n]: 
n

make sure you specify "no"

  1. Then load the DESeq2
library(DESeq2)

Some of you will not get any errors after this, when executing the DESeq Tutorial.

Some of will get errors when you try to do the following:

> ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable,
+                                        directory = directory,
+                                        design = ~ condition)
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'normalize_names_replacement_value' not found

At this point make sure you no not have any discripensy in other packages.
You can check this using:

BiocManager::valid()

As an example:
misc, robustbase, and rstanarm are out of date and rsconnect is too new is from the validation line

So at this point you would have to do the same as before and download the packages from rcyan which is compatible to your R version, as shown above and install it.

In the above example you would download the packages for misc, robustbase, and rstanarm and install the current versions for your R version, and for rsconnect downgrade to a older version.